    /* 豆包 Doubao 风格 AI 编程界面 */
    :root {
        --ai-accent: #0066FF;
        --ai-accent-hover: #0052CC;
        --ai-accent-soft: rgba(0, 102, 255, 0.08);
        --ai-accent-soft-hover: rgba(0, 102, 255, 0.12);
        --ai-border: #EBEDF0;
        --ai-border-light: #F2F3F5;
        --ai-text: #1F2329;
        --ai-text-secondary: #646A73;
        --ai-muted: #86909C;
        --ai-user-bubble: #F2F3F5;
        --ai-sidebar-bg: #FAFBFC;
        --ai-sidebar-brand: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
        --ai-composer-shadow: 0 4px 24px rgba(31, 35, 41, 0.06), 0 0 1px rgba(31, 35, 41, 0.08);
        --ai-radius-lg: 20px;
        --ai-radius-md: 12px;
        --ai-sidebar-w: 280px;
    }

    .ai-page-head { display: none; }
    .ai-sidebar-toggle { display: none; }
    .ai-dsk-sidebar-expand {
        display: inline-flex; align-items: center; gap: 6px;
        margin: 10px 16px 0; align-self: flex-start;
        padding: 6px 12px; font-size: 13px; font-weight: 500;
        color: var(--ai-text-secondary); background: #fff;
        border: 1px solid var(--ai-border); border-radius: 8px;
        cursor: pointer; transition: border-color .15s, color .15s;
        flex-shrink: 0;
    }
    .ai-dsk-sidebar-expand:hover { color: var(--ai-accent); border-color: rgba(0,102,255,.35); }
    .ai-dsk-sidebar-expand[hidden] { display: none !important; }

    .ai-dsk-root {
        display: flex; gap: 0; margin: 0; min-height: 0;
        background: #fff; border-radius: 0; overflow: hidden; border: none;
        font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
        flex: 1;
    }
    .ai-dsk-root--official,
    .ai-dsk-root--master { min-height: 0; }
    body.ai-chat-layout.official-ai-embed .ai-dsk-root--official {
        height: 100%;
        min-height: 0;
    }

    /* 整页不滚动：仅 .ai-dsk-chat 消息区滚动，输入框固定底部 */
    html.ai-chat-layout,
    body.ai-chat-layout {
        height: 100%;
        overflow: hidden;
    }
    body.ai-chat-layout.official-ai-embed {
        height: 100vh; height: 100dvh;
    }
    body.ai-chat-layout.official-ai-embed .bce-head { flex-shrink: 0; }
    body.ai-chat-layout .ai-chat-shell {
        flex: 1; min-height: 0; overflow: hidden;
        display: flex; flex-direction: column;
    }
    body.ai-chat-layout .ai-chat-shell > .ai-quota-bar { flex-shrink: 0; }
    body.ai-chat-layout .ai-chat-shell > .ai-tool-primary-nav { flex-shrink: 0; }
    body.ai-chat-layout .ai-chat-shell > .ai-dsk-root {
        flex: 1; min-height: 0;
    }
    body.ai-chat-layout .admin-main > .wrap > .master-tip-box,
    body.ai-chat-layout .ai-official-page > .master-tip-box { flex-shrink: 0; margin-bottom: 0; }
    body.ai-chat-layout.official-ai-embed .bce-page--minimal {
        height: 100vh; height: 100dvh; overflow: hidden;
        display: flex; flex-direction: column;
    }
    body.ai-chat-layout.official-ai-embed .bce-main-minimal {
        flex: 1; min-height: 0; overflow: hidden;
        display: flex; flex-direction: column;
    }
    body.ai-chat-layout .ai-official-page {
        flex: 1; min-height: 0; overflow: hidden;
        display: flex; flex-direction: column;
    }
    body.ai-chat-layout .admin-main {
        height: calc(100vh - 56px); min-height: 0; overflow: hidden;
        padding: 0; display: flex; flex-direction: column; box-sizing: border-box;
    }
    body.ai-chat-layout .admin-main > .wrap {
        flex: 1; min-height: 0; overflow: hidden;
        display: flex; flex-direction: column;
        border: none; border-radius: 0; padding: 0; box-shadow: none; background: #fff;
    }
    body.ai-chat-layout .admin-main .wrap > .alert {
        flex-shrink: 0; margin: 8px 16px 0; border-radius: 6px;
    }
    .ai-dsk-root.ai-sidebar-collapsed .ai-dsk-hist { display: none; }

    /* —— 侧栏 —— */
    .ai-dsk-hist {
        width: var(--ai-sidebar-w); flex-shrink: 0;
        background: var(--ai-sidebar-bg);
        display: flex; flex-direction: column;
        min-height: 0;
        border-right: 1px solid var(--ai-border);
        box-shadow: inset -1px 0 0 rgba(255,255,255,0.6);
    }
    .ai-dsk-sidebar-brand {
        display: flex; align-items: center; gap: 12px;
        padding: 20px 18px 16px;
        border-bottom: 1px solid var(--ai-border-light);
    }
    .ai-dsk-sidebar-brand-mark {
        width: 40px; height: 40px; flex-shrink: 0;
        display: flex; align-items: center; justify-content: center;
        border-radius: 12px;
        background: var(--ai-sidebar-brand);
        color: #fff;
        box-shadow: 0 6px 16px rgba(0, 102, 255, 0.28);
    }
    .ai-dsk-sidebar-brand-mark svg { width: 22px; height: 22px; }
    .ai-dsk-sidebar-brand-text { min-width: 0; }
    .ai-dsk-sidebar-brand-text strong {
        display: block; font-size: 15px; font-weight: 600;
        color: var(--ai-text); letter-spacing: 0.01em; line-height: 1.3;
    }
    .ai-dsk-sidebar-brand-text span {
        display: block; margin-top: 2px;
        font-size: 12px; color: var(--ai-muted); line-height: 1.4;
    }
    .ai-dsk-hist-head {
        padding: 12px 16px 6px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    }
    .ai-dsk-hist-head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
    .ai-dsk-hist-head-left > span {
        font-size: 11px; font-weight: 600; color: var(--ai-muted);
        letter-spacing: 0.08em; text-transform: uppercase;
    }
    .ai-dsk-hist-close {
        font-size: 12px; font-weight: 400; padding: 4px 8px; border: none; background: transparent;
        color: var(--ai-muted); cursor: pointer; border-radius: 6px;
    }
    .ai-dsk-hist-close:hover { background: rgba(0,0,0,.04); color: var(--ai-text-secondary); }
    .ai-dsk-hist-head button#ai-hist-del {
        font-size: 12px; padding: 4px 8px; border-radius: 6px; border: none; background: transparent;
        color: var(--ai-muted); cursor: pointer;
    }
    .ai-dsk-hist-head button#ai-hist-del:hover:not(:disabled) { background: rgba(0,0,0,.04); color: #F53F3F; }
    .ai-dsk-hist-head button#ai-hist-del:disabled { opacity: .35; cursor: not-allowed; }

    .ai-dsk-new-chat-wrap { padding: 4px 12px 12px; }
    .ai-dsk-new-chat {
        width: 100%;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 11px 16px;
        font-size: 14px;
        color: #000000;
        background: transparent;
        border: none;
        cursor: pointer;
    }
    .ai-dsk-new-chat svg { width: 16px; height: 16px; color: #000; flex-shrink: 0; }
    .ai-dsk-new-chat:hover { color: var(--ai-accent); background: rgba(0, 0, 0, 0.03); border-radius: 8px; }

    /* —— 一级功能菜单（AI 编程 / 文生视频 / 文生图 …） —— */
    .ai-tool-primary-nav {
        flex-shrink: 0;
        background: #fff;
        border-bottom: 1px solid var(--ai-border);
        box-shadow: 0 1px 0 rgba(31, 35, 41, 0.04);
    }
    .ai-tool-primary-nav-inner {
        display: flex; align-items: stretch; gap: 2px;
        padding: 0 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .ai-tool-primary-nav-inner::-webkit-scrollbar { display: none; }
    .ai-tool-primary-nav-item {
        flex-shrink: 0;
        display: inline-flex; align-items: center; gap: 6px;
        padding: 14px 16px;
        font-size: 14px; font-weight: 500;
        color: var(--ai-text-secondary);
        text-decoration: none;
        border-bottom: 2px solid transparent;
        margin-bottom: -1px;
        transition: color .15s, border-color .15s, background .15s;
        white-space: nowrap;
    }
    .ai-tool-primary-nav-ico {
        width: 18px;
        height: 18px;
        object-fit: contain;
        flex-shrink: 0;
        border-radius: 4px;
    }
    .ai-tool-primary-nav-item:hover {
        color: var(--ai-accent);
        background: rgba(0, 102, 255, 0.04);
    }
    .ai-tool-primary-nav-item.is-active {
        color: var(--ai-accent);
        font-weight: 600;
        border-bottom-color: var(--ai-accent);
        background: rgba(0, 102, 255, 0.06);
    }

    /* —— 侧栏功能菜单（树形：一行一项） —— */
    .ai-dsk-tool-nav {
        flex-shrink: 0;
        padding: 4px 10px 14px;
        border-bottom: 1px solid var(--ai-border-light);
    }
    .ai-dsk-tool-nav .ai-dsk-hist-section-head { margin: 6px 10px 8px; }
    .ai-dsk-tool-nav-list {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
    }
    .ai-dsk-tool-nav-item {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
        padding: 9px 12px;
        border-radius: 10px;
        border: 1px solid transparent;
        background: transparent;
        font-size: 13px;
        font-weight: 500;
        color: var(--ai-text-secondary);
        text-decoration: none;
        cursor: pointer;
        transition: background .15s, color .15s, border-color .15s;
        white-space: nowrap;
    }
    .ai-dsk-tool-nav-item:hover {
        background: rgba(0, 102, 255, 0.05);
        color: var(--ai-text);
    }
    .ai-dsk-tool-nav-item.is-active {
        background: rgba(0, 102, 255, 0.09);
        border-color: rgba(0, 102, 255, 0.14);
        color: var(--ai-accent);
        font-weight: 600;
    }
    .ai-dsk-tool-nav-ico {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 7px;
        background: rgba(0, 102, 255, 0.08);
        color: var(--ai-accent);
        font-size: 12px;
        line-height: 1;
        overflow: hidden;
    }
    .ai-dsk-tool-nav-ico img {
        width: 18px;
        height: 18px;
        object-fit: contain;
        display: block;
    }
    .ai-dsk-tool-nav-item.is-active .ai-dsk-tool-nav-ico {
        background: var(--ai-accent);
        color: #fff;
    }
    .ai-dsk-tool-nav-item > span:last-child {
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .ai-dsk-hist-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 10px 18px; }
    .ai-dsk-hist-scroll::-webkit-scrollbar { width: 4px; }
    .ai-dsk-hist-scroll::-webkit-scrollbar-thumb { background: #D9D9D9; border-radius: 4px; }

    .ai-dsk-hist-section { margin-bottom: 10px; }
    .ai-dsk-hist-section-head { margin: 10px 10px 8px; }
    .ai-dsk-hist-section-title {
        font-size: 11px; font-weight: 600; color: var(--ai-muted); margin: 0;
        letter-spacing: 0.06em; text-transform: uppercase;
    }

    .ai-dsk-hist-item {
        display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; margin-bottom: 4px;
        border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ai-text-secondary);
        line-height: 1.45; background: transparent; border: 1px solid transparent;
        transition: background .12s, border-color .12s, box-shadow .12s;
    }
    .ai-dsk-hist-item:hover { background: rgba(0, 102, 255, 0.04); color: var(--ai-text); border-color: rgba(0, 102, 255, 0.08); }
    .ai-dsk-hist-item.is-active {
        background: #fff; color: var(--ai-text);
        border-color: rgba(0, 102, 255, 0.16);
        box-shadow: 0 2px 10px rgba(0, 102, 255, 0.08);
    }
    .ai-dsk-hist-item input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; width: 14px; height: 14px; accent-color: var(--ai-accent); cursor: pointer; }
    .ai-hist-row-body { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; flex: 1; }
    .ai-hist-row-title {
        display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
        word-break: break-word; font-weight: 400; flex: 1; min-width: 0;
    }
    .ai-hist-row-time { font-size: 11px; color: var(--ai-muted); flex-shrink: 0; white-space: nowrap; }
    .ai-dsk-hist-item.is-active .ai-hist-row-time { color: var(--ai-muted); }

    .ai-dsk-ws-item {
        display: flex; align-items: center; gap: 4px; padding: 10px 12px; margin-bottom: 4px;
        border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--ai-text-secondary);
        line-height: 1.45; background: transparent; border: 1px solid transparent;
        transition: background .12s, border-color .12s;
    }
    .ai-dsk-ws-item:hover { background: rgba(0, 102, 255, 0.04); color: var(--ai-text); }
    .ai-dsk-ws-item.is-active {
        background: #fff; color: var(--ai-accent);
        border-color: rgba(0, 102, 255, 0.16);
        box-shadow: 0 2px 10px rgba(0, 102, 255, 0.08);
    }
    .ai-dsk-ws-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
    .ai-dsk-ws-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
    .ai-dsk-ws-meta { font-size: 11px; color: var(--ai-muted); }
    .ai-dsk-ws-item.is-active .ai-dsk-ws-meta { color: rgba(0,102,255,.65); }
    .ai-dsk-ws-block { margin-bottom: 0; }
    .ai-dsk-ws-toggle {
        flex-shrink: 0; width: 20px; height: 20px; padding: 0; border: none; background: transparent;
        color: var(--ai-muted); cursor: pointer; border-radius: 4px; display: inline-flex;
        align-items: center; justify-content: center; font-size: 9px; transition: transform .15s, color .15s;
    }
    .ai-dsk-ws-toggle:hover { color: var(--ai-accent); }
    .ai-dsk-ws-toggle.is-open { transform: rotate(90deg); color: var(--ai-accent); }
    .ai-dsk-ws-toggle.is-empty { visibility: hidden; pointer-events: none; }
    .ai-dsk-ws-remove {
        flex-shrink: 0; width: 22px; height: 22px; padding: 0; border: none; background: transparent;
        color: var(--ai-muted); cursor: pointer; border-radius: 4px; font-size: 14px; line-height: 1;
        display: inline-flex; align-items: center; justify-content: center; opacity: 0;
        transition: opacity .12s, color .12s, background .12s;
    }
    .ai-dsk-ws-item:hover .ai-dsk-ws-remove, .ai-dsk-ws-item.is-active .ai-dsk-ws-remove { opacity: 1; }
    .ai-dsk-ws-remove:hover { color: #E5484D; background: rgba(229,72,77,.08); }

    .ai-dsk-file-tree {
        margin: 0 4px 6px 12px; padding: 2px 0; max-height: 240px; overflow: auto;
        border-left: 1px solid var(--ai-border-light); font-size: 12px;
    }
    .ai-ft-row {
        display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 6px;
        cursor: pointer; color: var(--ai-text-secondary); line-height: 1.35; min-width: 0;
    }
    .ai-ft-row:hover { background: rgba(0,0,0,.04); }
    .ai-ft-row.is-file.is-active { background: var(--ai-accent-soft); color: var(--ai-accent); }
    .ai-ft-toggle {
        flex-shrink: 0; width: 14px; height: 14px; padding: 0; border: none; background: transparent;
        color: var(--ai-muted); cursor: pointer; font-size: 8px;
        display: inline-flex; align-items: center; justify-content: center;
    }
    .ai-ft-toggle.is-open { transform: rotate(90deg); }
    .ai-ft-toggle.is-leaf { visibility: hidden; pointer-events: none; }
    .ai-ft-icon { flex-shrink: 0; width: 14px; text-align: center; font-size: 11px; opacity: .8; }
    .ai-ft-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
    .ai-ft-children { margin-left: 8px; }
    .ai-dsk-file-tree-loading, .ai-dsk-file-tree-empty { padding: 6px 8px; font-size: 11px; color: var(--ai-muted); }

    /* —— 代码预览 —— */
    .ai-dsk-preview {
        width: min(40vw, 460px); flex-shrink: 0; display: none; flex-direction: column; min-height: 0;
        border-right: 1px solid var(--ai-border-light); background: #1e1e1e; color: #d4d4d4;
    }
    .ai-dsk-root.ai-preview-open .ai-dsk-preview { display: flex; }
    .ai-dsk-preview-head {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        padding: 8px 10px 0; background: #252526; flex-shrink: 0; flex-wrap: wrap;
    }
    .ai-dsk-preview-tabs { display: flex; flex: 1; min-width: 0; gap: 4px; overflow-x: auto; padding-bottom: 6px; }
    .ai-dsk-preview-tab {
        display: inline-flex; align-items: center; gap: 4px; max-width: 130px; flex-shrink: 0;
        padding: 5px 8px; border-radius: 6px 6px 0 0; border: 1px solid #333; border-bottom: none;
        background: #1e1e1e; color: #aaa; font-size: 11px; cursor: pointer;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    }
    .ai-dsk-preview-tab.is-active { color: #fff; border-color: #444; }
    .ai-dsk-preview-tab-x {
        flex-shrink: 0; width: 14px; height: 14px; padding: 0; border: none; background: transparent;
        color: #888; cursor: pointer; font-size: 12px;
    }
    .ai-dsk-preview-close {
        flex-shrink: 0; font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid #444;
        background: #333; color: #ddd; cursor: pointer; margin-bottom: 6px;
    }
    .ai-dsk-preview-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-bottom: 6px; }
    .ai-dsk-preview-action-btn {
        font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid #555;
        background: #3c3c3c; color: #ddd; cursor: pointer;
    }
    .ai-dsk-preview-action-btn.is-primary { background: var(--ai-accent); border-color: var(--ai-accent); color: #fff; }
    .ai-dsk-preview-action-btn:disabled { opacity: .4; cursor: not-allowed; }
    .ai-dsk-preview-editor {
        width: 100%; min-height: calc(100% - 4px); box-sizing: border-box; border: none; outline: none; resize: none;
        background: #1e1e1e; color: #d4d4d4; font-family: ui-monospace, Menlo, Consolas, monospace;
        font-size: 13px; line-height: 1.55; padding: 12px 14px; display: block;
    }
    .ai-dsk-preview-meta {
        padding: 6px 12px; font-size: 11px; color: #888; background: #252526; border-bottom: 1px solid #333;
    }
    .ai-dsk-preview-body { flex: 1; min-height: 0; overflow: auto; padding: 0; font-size: 12px; }

    /* —— 主聊天区 —— */
    .ai-dsk-main {
        flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0;
        overflow: hidden; background: #fff;
    }
    .ai-dsk-main-card {
        width: 100%; flex: 1; min-height: 0; display: flex; flex-direction: column;
        background: #fff; overflow: hidden;
    }
    .ai-dsk-chat-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; overflow: hidden; }
    .ai-dsk-chat {
        flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 24px 24px 12px;
        scroll-behavior: smooth; background: #fff;
        overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
    }
    .ai-dsk-chat::-webkit-scrollbar { width: 5px; }
    .ai-dsk-chat::-webkit-scrollbar-thumb { background: #E0E0E0; border-radius: 5px; }

    /* 欢迎空状态 */
    .ai-dsk-empty {
        display: flex; flex-direction: column; align-items: center; justify-content: center;
        min-height: 220px; padding: 28px 24px 36px; text-align: center;
    }
    .ai-welcome-logo {
        width: 52px; height: 52px; border-radius: 16px; margin-bottom: 16px;
        background: linear-gradient(145deg, #0066FF 0%, #4D9AFF 100%);
        display: flex; align-items: center; justify-content: center;
        box-shadow: 0 4px 16px rgba(0, 102, 255, 0.12);
    }
    .ai-welcome-logo svg { width: 26px; height: 26px; color: #fff; }
    .ai-welcome-title {
        font-size: 20px; font-weight: 500; color: var(--ai-text); margin: 0 0 8px; line-height: 1.45;
        letter-spacing: 0;
    }
    .ai-welcome-sub {
        font-size: 13px; color: var(--ai-text-secondary); margin: 0; line-height: 1.75; max-width: 480px;
    }
    .ai-welcome-model {
        display: block; margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--ai-muted);
    }
    .ai-welcome-hints {
        display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
        margin-top: 18px; max-width: 520px;
    }
    .ai-welcome-hint {
        padding: 6px 12px; font-size: 12px; color: var(--ai-text-secondary);
        background: #F7F8FA; border: 1px solid var(--ai-border-light); border-radius: 20px;
    }

    /* —— 输入框（豆包悬浮卡片） —— */
    .ai-dsk-composer-wrap {
        padding: 12px 24px 16px; background: #fff; flex-shrink: 0;
        width: 100%; box-sizing: border-box;
        border-top: 1px solid var(--ai-border-light);
    }
    .ai-dsk-composer-wrap .ai-dsk-composer {
        max-width: 820px; margin: 0 auto;
    }
    .ai-dsk-composer {
        border: 1px solid var(--ai-border); border-radius: var(--ai-radius-lg);
        background: #fff; padding: 14px 16px 10px; box-shadow: var(--ai-composer-shadow);
        transition: border-color .15s, box-shadow .15s;
    }
    .ai-dsk-composer:focus-within {
        border-color: rgba(0,102,255,.35);
        box-shadow: 0 4px 24px rgba(0,102,255,.1), 0 0 0 3px rgba(0,102,255,.06);
    }
    .ai-dsk-textarea {
        width: 100%; min-height: 52px; max-height: 200px; resize: none; border: none;
        background: transparent; font-size: 15px; line-height: 1.6; color: var(--ai-text);
        outline: none; padding: 0; font-family: inherit;
    }
    .ai-dsk-textarea::placeholder { color: #C9CDD4; }
    .ai-dsk-composer-bar {
        display: flex; align-items: center; justify-content: space-between;
        gap: 8px; margin-top: 10px; padding-top: 0; border-top: none;
    }
    .ai-dsk-toggles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
    .ai-dsk-bar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

    .ai-dsk-plus-btn {
        display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
        border-radius: 50%; border: none; background: var(--ai-border-light); color: var(--ai-text-secondary);
        cursor: pointer; transition: background .15s, color .15s;
    }
    .ai-dsk-plus-btn:hover, .ai-dsk-plus-btn.is-open { background: var(--ai-accent-soft); color: var(--ai-accent); }
    .ai-dsk-upload-wrap { position: relative; display: inline-flex; }
    .ai-dsk-upload-menu {
        position: absolute; left: 0; bottom: calc(100% + 8px); min-width: 168px; background: #fff;
        border: 1px solid var(--ai-border); border-radius: var(--ai-radius-md);
        box-shadow: 0 8px 32px rgba(31,35,41,.12); padding: 6px; z-index: 50; display: none;
    }
    .ai-dsk-upload-menu.is-open { display: block; }
    .ai-dsk-upload-menu button {
        display: block; width: 100%; text-align: left; border: none; background: transparent;
        padding: 9px 12px; font-size: 13px; color: var(--ai-text); border-radius: 8px; cursor: pointer;
    }
    .ai-dsk-upload-menu button:hover { background: var(--ai-accent-soft); color: var(--ai-accent); }

    .ai-dsk-toggle {
        display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 999px;
        font-size: 13px; font-weight: 400; border: 1px solid transparent; background: transparent;
        color: var(--ai-text-secondary); cursor: pointer; user-select: none; transition: .12s;
    }
    .ai-dsk-toggle:hover { background: var(--ai-border-light); color: var(--ai-text); }
    .ai-dsk-toggle.is-on { background: var(--ai-accent-soft); color: var(--ai-accent); }
    .ai-msg-assistant-toolbar {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 10px;
        padding-top: 8px;
        border-top: 1px solid rgba(0,0,0,0.06);
    }
    .ai-msg-prompt-cat-wrap {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 4px 8px;
        border-radius: 8px;
        background: #f5f7fa;
        font-size: 12px;
        color: var(--ai-text-secondary);
    }
    .ai-msg-prompt-cat-wrap span { white-space: nowrap; }
    .ai-msg-prompt-cat-select {
        border: none;
        background: transparent;
        font-size: 12px;
        color: var(--ai-text);
        max-width: 140px;
        outline: none;
        cursor: pointer;
    }
    .ai-msg-save-prompt-btn {
        border: none;
        background: #f0f5ff;
        color: #1677ff;
        font-size: 12px;
        padding: 4px 10px;
        border-radius: 6px;
        cursor: pointer;
    }
    .ai-msg-save-prompt-btn:hover:not(:disabled) { background: #e6f4ff; }
    .ai-msg-save-prompt-btn.is-done { background: #f6ffed; color: #389e0d; }
    .ai-dsk-toggle-icon-wrap { position: relative; width: 16px; height: 16px; flex-shrink: 0; }
    .ai-dsk-toggle-icon-wrap img { position: absolute; left: 0; top: 0; width: 16px; height: 16px; object-fit: contain; }
    .ai-dsk-toggle-icon-on { visibility: hidden; }
    .ai-dsk-toggle.is-on .ai-dsk-toggle-icon-off { visibility: hidden; }
    .ai-dsk-toggle.is-on .ai-dsk-toggle-icon-on { visibility: visible; }

    .ai-dsk-attach-btn {
        display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
        border-radius: 50%; border: none; background: transparent; color: var(--ai-muted); cursor: pointer;
    }
    .ai-dsk-attach-btn:hover { color: var(--ai-accent); background: var(--ai-accent-soft); }
    .ai-dsk-dl-btn {
        font-size: 12px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--ai-border);
        background: #fff; color: var(--ai-text-secondary); cursor: pointer; transition: .12s;
    }
    .ai-dsk-dl-btn:hover:not(:disabled) { border-color: var(--ai-accent); color: var(--ai-accent); background: var(--ai-accent-soft); }
    .ai-dsk-dl-btn:disabled { opacity: .35; cursor: not-allowed; }
    .ai-dsk-send {
        display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
        border-radius: 50%; border: none; background: var(--ai-accent); color: #fff; cursor: pointer;
        flex-shrink: 0; transition: background .15s, transform .1s, opacity .15s;
    }
    .ai-dsk-send:hover { background: var(--ai-accent-hover); }
    .ai-dsk-send:active { transform: scale(0.95); }
    .ai-dsk-send:disabled { opacity: .35; cursor: not-allowed; background: var(--ai-accent); }

    .ai-dsk-disclaimer {
        text-align: center; font-size: 12px; color: #C9CDD4; margin: 8px 0 0; padding: 0;
    }

    /* —— 消息气泡 —— */
    .ai-msg-row {
        display: flex; margin-bottom: 20px; max-width: min(760px, 100%);
        margin-left: auto; margin-right: auto;
    }
    .ai-msg-row--user { justify-content: flex-end; }
    .ai-msg-row--assistant { justify-content: flex-start; }
    .ai-msg-avatar { display: none; }
    .ai-msg-bubble-wrap { max-width: 100%; min-width: 0; }
    .ai-msg-row--user .ai-msg-bubble-wrap { flex: 0 1 auto; max-width: 85%; }
    .ai-msg-role { display: none; }
    .ai-msg-body {
        padding: 12px 16px; border-radius: 16px; font-size: 15px; line-height: 1.7;
        white-space: pre-wrap; word-break: break-word; color: var(--ai-text);
    }
    .ai-msg-row--user .ai-msg-body {
        position: relative;
        padding: 8px 14px 12px;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
    .ai-msg-user-toolbar {
        position: static;
        display: flex;
        gap: 6px;
        flex-shrink: 0;
        align-self: flex-end;
    }
    .ai-msg-user-content {
        display: block;
        align-self: flex-end;
        max-width: 100%;
        text-align: right;
    }
    .ai-msg-copy-btn,
    .ai-msg-resend-btn {
        font-size: 11px; padding: 2px 6px; border-radius: 4px; cursor: pointer;
        border: none; background: transparent; color: var(--ai-muted);
    }
    .ai-msg-copy-btn:hover,
    .ai-msg-resend-btn:hover { color: var(--ai-accent); }
    .ai-msg-row--user .ai-msg-body--fill {
        background: var(--ai-user-bubble); border-radius: 16px 16px 4px 16px;
    }
    .ai-msg-row--assistant .ai-msg-body {
        background: transparent; padding: 4px 0; border-radius: 0;
    }
    .ai-msg-row--assistant .ai-msg-body .ai-msg-link { color: var(--ai-accent); text-decoration: underline; }
    .ai-msg-body.ai-msg-streaming::after {
        content: ''; display: inline-block; width: 4px; height: 16px; margin-left: 2px;
        background: var(--ai-accent); animation: ai-caret .9s steps(1,end) infinite; vertical-align: -2px;
    }
    @keyframes ai-caret { 0%,49%{opacity:1;} 50%,100%{opacity:0;} }

    .ai-dsk-attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
    .ai-dsk-attach-chips:empty { display: none; }
    .ai-dsk-chip-ws, .ai-dsk-chip-file {
        display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px;
        font-size: 12px; color: var(--ai-accent); background: var(--ai-accent-soft); border: none; max-width: 280px;
    }
    .ai-dsk-chip-ws strong { font-weight: 600; }
    .ai-dsk-chip-remove {
        flex-shrink: 0; width: 16px; height: 16px; padding: 0; border: none; border-radius: 50%;
        background: rgba(0,102,255,.15); color: var(--ai-accent); font-size: 12px; line-height: 1;
        cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    }
    .ai-dsk-chip-remove:hover { background: rgba(229,72,77,.15); color: #E5484D; }
    .ai-dsk-upload-progress { font-size: 12px; color: var(--ai-accent); padding: 4px 0 0; }

    .ai-dsk-result-downloads {
        display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
        margin-bottom: 8px; padding: 8px 12px; border-radius: var(--ai-radius-md);
        background: #f0f7ff; border: 1px solid rgba(0,102,255,.15);
    }
    .ai-dsk-result-downloads[hidden] { display: none !important; }
    .ai-dsk-dl-bar-label { font-size: 12px; color: var(--ai-text-secondary); flex-shrink: 0; }
    .ai-dsk-dl-chip {
        display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
        font-size: 12px; color: var(--ai-accent); background: #fff; border: 1px solid rgba(0,102,255,.25);
        text-decoration: none; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .ai-dsk-dl-chip:hover { background: var(--ai-accent-soft); }
    .ai-dsk-dl-chip--zip { font-weight: 600; border-color: var(--ai-accent); }

    .ai-msg-downloads {
        display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px;
        padding-top: 10px; border-top: 1px dashed var(--ai-border);
    }
    .ai-msg-downloads-label { font-size: 12px; color: var(--ai-muted); }
    .ai-msg-download-link {
        font-size: 12px; color: var(--ai-accent); text-decoration: none;
        padding: 4px 10px; border-radius: 999px; background: var(--ai-accent-soft);
    }
    .ai-msg-download-link:hover { text-decoration: underline; }
    .ai-msg-download-link--zip { font-weight: 600; }

    .ai-dsk-preview-binary {
        padding: 24px; text-align: center; color: var(--ai-text-secondary); font-size: 13px;
    }
    .ai-dsk-preview-binary-btn {
        margin-top: 12px; padding: 8px 16px; border-radius: 8px; border: none;
        background: var(--ai-accent); color: #fff; cursor: pointer; font-size: 13px;
    }

    .ai-dsk-pending-images {
        display: none; flex-wrap: wrap; gap: 8px; padding: 0 0 8px;
        width: 100%; box-sizing: border-box;
    }
    .ai-dsk-pending-images.has-images { display: flex; }
    .ai-pending-img-wrap {
        position: relative; width: 72px; height: 72px; border-radius: var(--ai-radius-md);
        overflow: hidden; border: 1px solid var(--ai-border); background: var(--ai-border-light);
    }
    .ai-pending-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
    .ai-pending-img-remove {
        position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border: none;
        border-radius: 50%; background: rgba(0,0,0,.5); color: #fff; font-size: 12px; cursor: pointer;
    }
    .ai-msg-images { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
    .ai-msg-image {
        max-width: min(220px, 100%); max-height: 220px; border-radius: var(--ai-radius-md);
        object-fit: cover; border: 1px solid var(--ai-border);
    }

    .ai-quota-bar {
        display: none;
    }
    body.ai-chat-layout:not(.official-ai-embed) .ai-quota-bar {
        display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
        padding: 8px 20px; font-size: 13px; color: var(--ai-text-secondary);
        background: var(--ai-accent-soft); border-bottom: 1px solid rgba(0,102,255,.12);
    }
    .ai-quota-bar.is-warn { background: #FFF7E8; border-bottom-color: #FFE7BA; color: #AD6800; }
    .ai-quota-bar a { color: var(--ai-accent); font-weight: 500; text-decoration: none; }

    /* 右上角：桌面客户端下载 */
    .ai-dsk-topbar {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        padding: 10px 20px; border-bottom: 1px solid var(--ai-border-light);
        flex-shrink: 0; background: #fff;
    }
    .ai-dsk-topbar-title { font-size: 14px; font-weight: 600; color: var(--ai-text); }
    .ai-dsk-topbar-sub { font-size: 12px; color: var(--ai-muted); font-weight: 400; margin-left: 8px; }
    .ai-dsk-topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
    .ai-dsk-dl-platform {
        display: inline-flex; align-items: center; gap: 6px;
        padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
        color: var(--ai-text-secondary); text-decoration: none;
        border: 1px solid var(--ai-border); background: #fff;
        transition: border-color .15s, color .15s, box-shadow .15s;
    }
    .ai-dsk-dl-platform:hover {
        border-color: var(--ai-accent); color: var(--ai-accent);
        box-shadow: 0 2px 8px rgba(0,102,255,.08);
    }
    .ai-dsk-dl-platform svg { width: 16px; height: 16px; flex-shrink: 0; }
    .ai-dsk-dl-platform em { font-style: normal; font-size: 10px; color: var(--ai-muted); margin-left: 2px; }
    .ai-dsk-agent-progress {
        flex-shrink: 0; padding: 0 20px 8px; font-size: 12px; color: var(--ai-accent);
        background: #fff; border-bottom: 1px solid var(--ai-border-light);
        min-height: 0;
    }
    .ai-dsk-agent-progress:empty { display: none; padding: 0; border: none; }
    .ai-dsk-agent-progress.is-on { display: block; padding: 6px 20px 10px; }

    /* —— 官网嵌入全屏 —— */
    body.official-ai-embed { background: #fff; }
    body.ai-chat-layout.official-ai-embed .bce-main-minimal { padding: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; }
    body.official-ai-embed .bce-foot { display: none; }

    /* 静态兜底页（ai-shell.html）与官网 layout 一致的全屏 flex */
    body.ai-static-shell {
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }
    body.ai-static-shell .bce-page--minimal {
        flex: 1;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    @media (max-width: 960px) {
        body.ai-chat-layout .ai-dsk-root { min-height: 0; }
    }

    @media (max-width: 768px) {
        body.ai-chat-layout .ai-dsk-root {
            flex-direction: column;
            position: relative;
            height: 100%;
            min-height: 0;
        }

        body.ai-chat-layout .ai-dsk-hist {
            position: fixed;
            left: 0;
            top: var(--bce-head-h, 56px);
            bottom: 0;
            width: min(300px, 88vw);
            max-height: none;
            height: auto;
            z-index: 920;
            transform: translateX(-105%);
            transition: transform .22s ease;
            border-right: 1px solid var(--ai-border);
            border-bottom: none;
            box-shadow: 8px 0 32px rgba(15, 23, 42, .12);
        }

        body.ai-chat-layout .ai-dsk-root:not(.ai-sidebar-collapsed) .ai-dsk-hist {
            transform: translateX(0);
        }

        body.ai-chat-layout .ai-dsk-root:not(.ai-sidebar-collapsed)::before {
            content: '';
            position: fixed;
            left: 0;
            right: 0;
            top: var(--bce-head-h, 56px);
            bottom: 0;
            background: rgba(15, 23, 42, .35);
            z-index: 910;
        }

        body.ai-chat-layout .ai-dsk-root.ai-sidebar-collapsed .ai-dsk-hist {
            display: flex;
        }

        .ai-dsk-sidebar-expand {
            display: inline-flex !important;
        }

        .ai-dsk-main {
            min-width: 0;
            width: 100%;
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }

        .ai-dsk-main-card {
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }

        .ai-dsk-chat-wrap {
            flex: 1;
            min-height: 0;
            overflow: hidden;
        }

        .ai-dsk-topbar {
            flex-wrap: nowrap;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
        }

        .ai-dsk-topbar > div:first-child {
            display: flex;
            align-items: center;
            flex-wrap: nowrap;
            gap: 8px;
            min-width: 0;
            flex: 1;
        }

        .ai-dsk-topbar-title {
            flex-shrink: 0;
            font-size: 15px;
        }

        .ai-dsk-topbar-sub {
            margin-left: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-size: 11px;
        }

        .ai-dsk-topbar-actions {
            display: none;
        }

        .ai-dsk-dl-platform {
            display: none !important;
        }

        .ai-dsk-preview {
            position: fixed;
            inset: var(--bce-head-h, 56px) 0 0 0;
            z-index: 930;
            width: 100%;
            max-width: none;
            border-left: none;
        }

        .ai-dsk-preview[hidden] { display: none !important; }

        .ai-dsk-chat {
            padding: 16px 12px 8px;
        }

        .ai-dsk-empty {
            min-height: 160px;
            padding: 20px 16px 24px;
        }

        .ai-welcome-title { font-size: 18px; }
        .ai-welcome-sub { font-size: 12px; }

        .ai-dsk-composer-wrap {
            padding: 8px 12px calc(12px + env(safe-area-inset-bottom, 0px));
            flex-shrink: 0;
        }

        .ai-dsk-composer {
            padding: 10px 12px 8px;
            border-radius: 16px;
        }

        .ai-dsk-textarea {
            min-height: 44px;
            max-height: 120px;
            font-size: 16px;
        }

        .ai-dsk-composer-bar {
            flex-wrap: nowrap;
            align-items: center;
            gap: 6px;
            margin-top: 8px;
        }

        .ai-dsk-toggles {
            flex: 1 1 auto;
            flex-wrap: nowrap;
            overflow-x: auto;
            min-width: 0;
            gap: 4px;
            -webkit-overflow-scrolling: touch;
            scrollbar-width: none;
        }

        .ai-dsk-toggles::-webkit-scrollbar { display: none; }

        .ai-dsk-bar-right {
            flex-shrink: 0;
            gap: 4px;
        }

        .ai-dsk-plus-btn,
        .ai-dsk-attach-btn {
            width: 28px;
            height: 28px;
            flex-shrink: 0;
        }

        .ai-dsk-plus-btn svg,
        .ai-dsk-attach-btn svg {
            width: 16px;
            height: 16px;
        }

        .ai-dsk-toggle {
            padding: 4px 8px;
            font-size: 12px;
            flex-shrink: 0;
        }

        .ai-dsk-toggle-icon-wrap {
            width: 14px;
            height: 14px;
        }

        .ai-dsk-toggle-icon-wrap img {
            width: 14px;
            height: 14px;
        }

        .ai-dsk-dl-btn {
            display: none;
        }

        .ai-dsk-send {
            width: 32px;
            height: 32px;
            flex-shrink: 0;
        }

        .ai-dsk-send svg {
            width: 16px;
            height: 16px;
        }

        .ai-dsk-disclaimer {
            margin-top: 6px;
            font-size: 11px;
        }

        .ai-dsk-tool-nav-list {
            flex-direction: column;
            flex-wrap: nowrap;
            overflow-x: visible;
            overflow-y: visible;
            gap: 2px;
            padding-bottom: 0;
        }

        .ai-dsk-tool-nav-item {
            width: 100%;
            flex: 0 0 auto;
            white-space: nowrap;
        }

        .ai-msg-row--user .ai-msg-bubble-wrap { max-width: 92%; }

        .ai-dsk-result-downloads { flex-direction: column; align-items: stretch; }
    }
