/* ============================================================
   云能官网 - AI 助手全局浮窗（v2 对齐移动端 pages/ai/chat.vue）
   ============================================================ */

/* ---------- 悬浮按钮 ---------- */
.ai-widget-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0066cc 0%, #3b82f6 100%);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 102, 204, 0.4);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.ai-widget-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 14px 36px rgba(0, 102, 204, 0.5);
}

.ai-widget-btn::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.35);
    animation: aiWidgetPulse 2.4s ease-out infinite;
}

@keyframes aiWidgetPulse {
    0%   { transform: scale(1);   opacity: 1; }
    70%  { transform: scale(1.45); opacity: 0; }
    100% { transform: scale(1.45); opacity: 0; }
}

[data-theme="dark"] .ai-widget-btn {
    background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
}

@media (max-width: 767px) {
    .ai-widget-btn {
        right: 16px;
        bottom: 16px;
        width: 52px;
        height: 52px;
        font-size: 22px;
    }
}

/* ---------- 弹窗面板 ---------- */
.ai-widget-panel {
    position: fixed;
    right: 24px;
    bottom: 92px;
    z-index: 9999;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0.85) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.3, 0.64, 1), opacity 0.3s ease;
}

.ai-widget-panel.open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

[data-theme="dark"] .ai-widget-panel {
    background: #1c1c1e;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* ---------- 头部（含关闭按钮，文本 × 保证可见） ---------- */
.ai-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: linear-gradient(135deg, #0066cc 0%, #3b82f6 100%);
    color: #fff;
    flex-shrink: 0;
}

.ai-widget-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.ai-widget-logo {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.ai-widget-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

/* DeepSeek V4.1 Flash 版本徽标 */
.ai-widget-model-badge {
    flex-shrink: 0;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.2px;
    color: #e8f2ff;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.42);
    white-space: nowrap;
    cursor: default;
}

@media (max-width: 420px) {
    /* 窄屏优先保证标题与操作按钮可见 */
    .ai-widget-model-badge {
        display: none;
    }
}

.ai-widget-close {
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 2px;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.ai-widget-close:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

.ai-widget-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* 「打开完整版」入口 */
.aw-full-btn {
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #fff;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.aw-full-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.08);
}

/* ---------- 登录状态条 ---------- */
.aw-auth-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid #eceef1;
    background: #f0f4fb;
    font-size: 12px;
    flex-shrink: 0;
}

[data-theme="dark"] .aw-auth-bar {
    background: #1d1d21;
    border-bottom-color: #2e2e33;
}

.aw-auth-bar .aw-auth-tip {
    color: #64748b;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aw-auth-bar .aw-auth-tip i {
    color: #3b82f6;
}

.aw-auth-bar .aw-auth-login {
    color: #fff;
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    border-radius: 14px;
    padding: 3px 12px;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.aw-auth-bar .aw-auth-login:hover {
    opacity: 0.85;
}

.aw-auth-bar .aw-auth-user {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.aw-auth-bar .aw-auth-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    color: #fff;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

.aw-auth-bar .aw-auth-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.aw-auth-bar .aw-auth-name {
    color: #333;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .aw-auth-bar .aw-auth-name {
    color: #e8e8e8;
}

.aw-auth-bar .aw-auth-logout {
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.aw-auth-bar .aw-auth-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ---------- 消息区 ---------- */
.ai-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f9fc;
}

[data-theme="dark"] .ai-widget-messages {
    background: #17171a;
}

/* 消息行：user 靠右，bot 靠左带头像 */
.aw-msg {
    display: flex;
    width: 100%;
}

.aw-msg.aw-user {
    justify-content: flex-end;
}

.aw-msg.aw-bot {
    justify-content: flex-start;
}

.aw-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    margin-top: 10px;
    flex-shrink: 0;
}

/* 用户消息头像：显示在消息右侧（对齐 AI 聊天页） */
.aw-msg.aw-user .aw-user-avatar {
    margin-right: 0;
    margin-left: 6px;
    background: #e9edf3;
    color: #64748b;
    overflow: hidden;
    order: 2;
}

.aw-msg.aw-user .aw-user-avatar img.aw-user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

[data-theme="dark"] .aw-msg.aw-user .aw-user-avatar {
    background: #2e2e33;
    color: #9aa0a6;
}

.aw-body {
    max-width: 86%;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.aw-msg.aw-user .aw-body {
    align-items: flex-end;
}

.aw-bubble {
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.aw-msg.aw-user .aw-bubble {
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aw-msg.aw-bot .aw-bubble {
    background: #fff;
    color: #333;
    border: 1px solid #ececec;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .aw-msg.aw-bot .aw-bubble {
    background: #242428;
    color: #e8e8e8;
    border-color: #2e2e33;
}

/* ---------- Markdown 渲染样式（对齐移动端） ---------- */
.aw-md {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.aw-md > :first-child { margin-top: 0; }
.aw-md > :last-child { margin-bottom: 0; }

.aw-md p {
    margin: 5px 0;
    line-height: 1.55;
}

.aw-md h1, .aw-md h2, .aw-md h3, .aw-md h4 {
    font-weight: 600;
    line-height: 1.4;
    margin: 8px 0 4px;
}

.aw-md h1 { font-size: 16px; }
.aw-md h2 { font-size: 15px; }
.aw-md h3 { font-size: 14px; }
.aw-md h4 { font-size: 13px; }

.aw-md ul, .aw-md ol {
    margin: 5px 0;
    padding-left: 18px;
}

.aw-md li {
    margin: 2px 0;
    line-height: 1.55;
}

.aw-md strong {
    font-weight: 600;
}

.aw-md del {
    color: #888;
    text-decoration: line-through;
}

.aw-md a {
    color: #0066cc;
    text-decoration: underline;
    word-break: break-all;
}

[data-theme="dark"] .aw-md a { color: #6cb4ff; }

.aw-md code {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 12px;
    background: rgba(0, 102, 204, 0.08);
    padding: 1px 5px;
    border-radius: 4px;
    color: #d63384;
    word-break: break-all;
}

.aw-msg.aw-user .aw-md code {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.aw-md pre {
    position: relative;
    background: #0f172a;
    color: #e2e8f0;
    padding: 10px 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 6px 0;
    font-size: 12px;
    line-height: 1.5;
    max-width: 100%;
}

.aw-md pre code {
    background: none;
    color: #e2e8f0;
    padding: 0;
    font-size: 12px;
    white-space: pre;
    word-break: normal;
}

.aw-md .code-lang-label {
    position: absolute;
    top: 0;
    right: 0;
    padding: 2px 8px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0 8px 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.aw-md blockquote {
    border-left: 3px solid #3b82f6;
    padding: 4px 8px;
    margin: 6px 0;
    color: #666;
    background: rgba(59, 130, 246, 0.06);
    border-radius: 0 6px 6px 0;
}

[data-theme="dark"] .aw-md blockquote {
    color: #aaa;
    background: rgba(59, 130, 246, 0.1);
}

.aw-md blockquote p { margin: 2px 0; }

.aw-md hr {
    border: none;
    border-top: 1px solid #ececec;
    margin: 8px 0;
}

/* 打开页面导航按钮 */
.aw-md a.nav-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 12px;
    background: rgba(0, 102, 204, 0.08);
    color: #0066cc;
    border: 1px solid #0066cc;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    margin: 2px 0;
    transition: background 0.15s;
}

.aw-md a.nav-link-btn:hover {
    background: #0066cc;
    color: #fff;
}

.aw-md a.nav-link-btn::after {
    content: ' →';
    font-weight: 400;
}

[data-theme="dark"] .aw-md a.nav-link-btn {
    color: #6cb4ff;
    border-color: #6cb4ff;
    background: rgba(108, 180, 255, 0.08);
}

[data-theme="dark"] .aw-md a.nav-link-btn:hover {
    background: #6cb4ff;
    color: #0f172a;
}

/* 图片 / 表格 */
.aw-md .markdown-image {
    max-width: 140px;
    max-height: 140px;
    border-radius: 8px;
    margin: 4px 0;
    display: inline-block;
    object-fit: cover;
}

.aw-md .nav-line,
.aw-md .image-line {
    margin: 4px 0;
}

.aw-md .image-line img { display: block; }

.aw-md .table-wrapper {
    overflow-x: auto;
    max-width: 100%;
    margin: 6px 0;
    border-radius: 6px;
    border: 1px solid #ececec;
    background: #fff;
}

[data-theme="dark"] .aw-md .table-wrapper {
    background: #242428;
    border-color: #2e2e33;
}

.aw-md .table-wrapper table {
    border-collapse: collapse;
    width: 100%;
    font-size: 11px;
    margin: 0;
    min-width: 200px;
}

.aw-md .table-wrapper th,
.aw-md .table-wrapper td {
    border: 1px solid #ececec;
    padding: 4px 8px;
    text-align: left;
    vertical-align: top;
}

[data-theme="dark"] .aw-md .table-wrapper th,
[data-theme="dark"] .aw-md .table-wrapper td {
    border-color: #2e2e33;
}

.aw-md .table-wrapper th {
    background: #f0f2f5;
    font-weight: 600;
}

[data-theme="dark"] .aw-md .table-wrapper th {
    background: #2c2c2e;
}

/* ---------- 思考中 ---------- */
.ai-widget-thinking {
    display: none;
    padding: 0 16px 8px;
    font-size: 12px;
    color: #888;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-widget-thinking::before {
    content: '⏳';
    margin-right: 4px;
}

.ai-widget-thinking.visible { display: block; }

[data-theme="dark"] .ai-widget-thinking { color: #9aa0a6; }

/* ---------- 猜你想问（followups 事件异步补发） ---------- */
.aw-followups {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    max-width: 100%;
}

.aw-followup-item {
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid #cfe0ff;
    border-radius: 999px;
    background: #f2f7ff;
    color: #2563eb;
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-followup-item:hover {
    background: #e3edff;
    border-color: #3b82f6;
}

[data-theme="dark"] .aw-followup-item {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(59, 130, 246, 0.35);
    color: #6cb4ff;
}

[data-theme="dark"] .aw-followup-item:hover {
    background: rgba(59, 130, 246, 0.25);
}

/* ---------- 用户协议与隐私政策同意弹窗（阻断式） ---------- */
.aw-consent-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* 显式声明：浮窗根容器在部分页面可能被设置为 pointer-events:none，
       这里必须自己也接住点击，否则遮罩虽在但拦不住底层页面 */
    pointer-events: auto;
    animation: awConsentFade 0.2s ease-out;
}

.aw-consent-mask.visible { display: flex; }

@keyframes awConsentFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.aw-consent {
    width: 420px;
    max-width: 100%;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
    overflow: hidden;
    animation: awConsentPop 0.25s ease-out;
}

@keyframes awConsentPop {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.aw-consent-header {
    padding: 18px 18px 10px;
    flex-shrink: 0;
}

.aw-consent-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1f2329;
}

.aw-consent-header h3 i {
    color: #3b82f6;
    margin-right: 6px;
}

.aw-consent-header p {
    margin-top: 5px;
    font-size: 12px;
    color: #8a8f99;
}

.aw-consent-body {
    padding: 0 18px 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12.5px;
    line-height: 1.7;
    color: #57606a;
}

.aw-consent-body p { margin-bottom: 8px; }

.aw-consent-body a {
    color: #2563eb;
    text-decoration: none;
    word-break: break-all;
}

.aw-consent-body a:hover { text-decoration: underline; }

.aw-consent-body ul {
    margin: 0 0 8px;
    padding: 10px 12px 10px 26px;
    list-style: disc;
    background: #eef4ff;
    border-radius: 10px;
    line-height: 1.7;
}

.aw-consent-body li { margin: 3px 0; }

.aw-consent-note {
    font-size: 11.5px;
    color: #8a8f99;
}

.aw-consent-actions {
    display: flex;
    gap: 10px;
    padding: 12px 18px 18px;
    flex-shrink: 0;
}

.aw-consent-btn {
    flex: 1;
    height: 40px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.aw-consent-btn:active { opacity: 0.8; }

.aw-consent-decline {
    background: #f2f4f8;
    border: 1px solid #e3e6ec;
    color: #57606a;
}

.aw-consent-decline:hover { background: #e8ebf1; }

.aw-consent-agree {
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    border: none;
    color: #fff;
    box-shadow: 0 5px 14px rgba(59, 130, 246, 0.28);
}

/* 未同意时悬浮按钮不可用 */
.ai-widget-btn.aw-consent-blocked {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.ai-widget-btn.aw-consent-blocked:hover { transform: none; }

.ai-widget-btn.aw-consent-blocked::after { display: none; }

/* 不同意后的轻提示 */
.aw-consent-tip {
    position: fixed;
    left: 50%;
    bottom: 96px;
    z-index: 10060;
    transform: translateX(-50%) translateY(8px);
    max-width: calc(100vw - 40px);
    padding: 9px 16px;
    border-radius: 999px;
    background: rgba(31, 35, 41, 0.92);
    color: #fff;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.aw-consent-tip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

[data-theme="dark"] .aw-consent {
    background: #242428;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
}

[data-theme="dark"] .aw-consent-header h3 { color: #f0f0f2; }

[data-theme="dark"] .aw-consent-header p,
[data-theme="dark"] .aw-consent-note { color: #9aa0a6; }

[data-theme="dark"] .aw-consent-body { color: #c8c8cc; }

[data-theme="dark"] .aw-consent-body ul { background: rgba(59, 130, 246, 0.14); }

[data-theme="dark"] .aw-consent-decline {
    background: #2e2e33;
    border-color: #3a3a3c;
    color: #c8c8cc;
}

[data-theme="dark"] .aw-consent-decline:hover { background: #38383a; }

/* ---------- 输入区 ---------- */
.ai-widget-inputbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
    overflow: hidden;
    min-width: 0;
}

[data-theme="dark"] .ai-widget-inputbar {
    border-top-color: #2e2e33;
    background: #1c1c1e;
}

.aw-agent-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #f7f9fc;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.aw-agent-btn:hover {
    border-color: #3b82f6;
    background: #eef4ff;
}

.aw-agent-icon {
    font-size: 12px;
    color: #0066cc;
    line-height: 1;
}

.aw-agent-label {
    font-size: 12px;
    color: #333;
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

[data-theme="dark"] .aw-agent-btn {
    background: #17171a;
    border-color: #2e2e33;
}

[data-theme="dark"] .aw-agent-btn:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .aw-agent-label {
    color: #e8e8e8;
}

.ai-widget-inputbar textarea {
    flex: 1;
    min-width: 0;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    padding: 9px 12px;
    font-size: 13px;
    resize: none;
    max-height: 100px;
    outline: none;
    background: #f7f9fc;
    color: #333;
    font-family: inherit;
    transition: border-color 0.2s ease;
    line-height: 1.5;
    overflow-x: hidden;
}

.ai-widget-inputbar textarea:focus {
    border-color: #3b82f6;
}

.ai-widget-inputbar textarea::placeholder {
    color: #9aa0a6;
}

[data-theme="dark"] .ai-widget-inputbar textarea {
    background: #17171a;
    border-color: #2e2e33;
    color: #e8e8e8;
}

.ai-widget-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0066cc, #3b82f6);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-widget-send:hover { transform: scale(1.08); }
.ai-widget-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ---------- Agent 选择浮层 ---------- */
.aw-agent-pop {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 60px;
    max-height: 70vh;
    display: none;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    border: 1px solid #ececec;
    flex-direction: column;
    z-index: 20;
    overflow: hidden;
}

.aw-agent-pop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #ececec;
    flex-shrink: 0;
}

.aw-agent-pop-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.aw-agent-pop-close {
    background: #f0f2f5;
    border: none;
    color: #666;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 1px;
    transition: background 0.2s;
}

.aw-agent-pop-close:hover {
    background: #e2e5ea;
}

/* Agent 列表：自然展开，不滚动 */
.aw-agent-pop-list {
    overflow-y: visible;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.aw-agent-opt {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.aw-agent-opt:hover {
    background: #f0f2f5;
}

.aw-agent-opt.selected {
    background: #eef4ff;
}

.aw-agent-opt-icon {
    font-size: 15px;
    color: #0066cc;
    margin-right: 10px;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.aw-agent-opt-info {
    flex: 1;
    min-width: 0;
}

.aw-agent-opt-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.aw-agent-opt-desc {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aw-agent-opt-check {
    font-size: 14px;
    color: #0066cc;
    margin-left: 8px;
    flex-shrink: 0;
}

[data-theme="dark"] .aw-agent-pop {
    background: #242428;
    border-color: #2e2e33;
}

[data-theme="dark"] .aw-agent-pop-header {
    border-color: #2e2e33;
}

[data-theme="dark"] .aw-agent-pop-title {
    color: #e8e8e8;
}

[data-theme="dark"] .aw-agent-opt:hover {
    background: #2c2c2e;
}

[data-theme="dark"] .aw-agent-opt.selected {
    background: rgba(59, 130, 246, 0.15);
}

[data-theme="dark"] .aw-agent-opt-name {
    color: #e8e8e8;
}

[data-theme="dark"] .aw-agent-opt-desc {
    color: #999;
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 767px) {
    .ai-widget-panel {
        right: 12px;
        left: 12px;
        bottom: 80px;
        width: auto;
        height: 62vh;
        max-height: calc(100vh - 100px);
    }

    .aw-body {
        max-width: 88%;
    }

    .aw-agent-pop {
        left: 8px;
        right: 8px;
    }
}

/* ---------- 面板内滚动条：细而浅，不黑不显眼 ---------- */
.ai-widget-panel *::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.ai-widget-panel *::-webkit-scrollbar-track {
    background: transparent;
}

.ai-widget-panel *::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.ai-widget-panel *::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.28);
}

.ai-widget-panel * {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}

[data-theme="dark"] .ai-widget-panel *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
}

[data-theme="dark"] .ai-widget-panel *::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

[data-theme="dark"] .ai-widget-panel * {
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* ==================== Markdown 渲染（与 App 端 ai-message 保持一致） ====================
   规则与 App 端 components/ai-message/ai-message.vue 一一对应：同一套 ai-* 类名、同一套排版。
   选择器带元素名（p./ul./table./pre.）是为了在同名旧规则之后稳定生效，无需 !important。
   注意：ai-widget.css 里有同名区块，改这里时记得一起改。 */
:root {
    --ai-md-text: #1f2329;
    --ai-md-text-2: #667085;
    --ai-md-border: #e8ecf2;
    --ai-md-divider: #eef1f6;
    --ai-md-accent: #3b82f6;
    --ai-md-code-bg: #1f2430;
    --ai-md-code-head: #171b26;
    --ai-md-code-text: #e6edf3;
    --ai-md-quote-bg: rgba(59, 130, 246, 0.06);
    --ai-md-quote-bar: #93b4f7;
    --ai-md-quote-text: #4a5568;
    --ai-md-inline-code-bg: #f0f2f5;
    --ai-md-inline-code-text: #d63384;
    --ai-md-done: #07c160;
}

[data-theme="dark"] {
    --ai-md-text: #EBEBF5;
    --ai-md-text-2: #A1A1A6;
    --ai-md-border: #38383A;
    --ai-md-divider: #38383A;
    --ai-md-accent: #60A5FA;
    --ai-md-code-bg: #16181d;
    --ai-md-code-head: #12141a;
    --ai-md-quote-bg: rgba(96, 165, 250, 0.1);
    --ai-md-quote-bar: #4b6a9b;
    --ai-md-quote-text: #C7C7CC;
    --ai-md-inline-code-bg: #3A3A3C;
    --ai-md-inline-code-text: #FF8FB1;
}

/* 系统深色兜底：页面没显式选亮色时跟随系统（未加载 upgrade.js 也不会漏） */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ai-md-text: #EBEBF5;
        --ai-md-text-2: #A1A1A6;
        --ai-md-border: #38383A;
        --ai-md-divider: #38383A;
        --ai-md-accent: #60A5FA;
        --ai-md-code-bg: #16181d;
        --ai-md-code-head: #12141a;
        --ai-md-quote-bg: rgba(96, 165, 250, 0.1);
        --ai-md-quote-bar: #4b6a9b;
        --ai-md-quote-text: #C7C7CC;
        --ai-md-inline-code-bg: #3A3A3C;
        --ai-md-inline-code-text: #FF8FB1;
    }
}

/* ---------- 段落 / 行内 ---------- */
p.ai-para {
    margin: 0 0 12px;
    font-size: 15px;
    line-height: 1.72;
    color: var(--ai-md-text);
}

p.ai-para:last-child {
    margin-bottom: 0;
}

/* 整行加粗 → 小标题层级（AI 常用 **小标题** 代替 ##） */
p.ai-para.is-title {
    margin: 20px 0 10px;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.5;
}

p.ai-para.is-title:first-child {
    margin-top: 0;
}

.ai-strong,
strong.ai-strong {
    font-weight: 600;
}

em.ai-italic,
.ai-italic {
    font-style: italic;
}

del.ai-strike {
    text-decoration: line-through;
    color: var(--ai-md-text-2);
}

code.ai-code-inline {
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    background: var(--ai-md-inline-code-bg);
    color: var(--ai-md-inline-code-text);
    padding: 1px 5px;
    border-radius: 4px;
    word-break: break-word;
}

a.ai-link,
a.ai-link-bare {
    color: var(--ai-md-accent);
    text-decoration: underline;
    word-break: break-all;
}

/* ---------- 标题（带层级色条） ---------- */
h1.ai-heading,
h2.ai-heading,
h3.ai-heading,
h4.ai-heading,
h5.ai-heading,
h6.ai-heading {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 11px 0 5px;
    font-weight: 700;
    line-height: 1.45;
    color: var(--ai-md-text);
}

h1.ai-heading:first-child,
h2.ai-heading:first-child,
h3.ai-heading:first-child {
    margin-top: 0;
}

.ai-heading .ai-heading-bar {
    flex-shrink: 0;
    width: 3px;
    height: 14px;
    border-radius: 2px;
    background: var(--ai-md-accent);
}

h1.ai-heading { font-size: 19px; }
h2.ai-heading { font-size: 17.5px; }
h2.ai-heading .ai-heading-bar { height: 12px; }
h3.ai-heading { font-size: 16px; }
h3.ai-heading .ai-heading-bar { height: 10px; background: #7aa7f5; }
h4.ai-heading { font-size: 15px; }
h5.ai-heading,
h6.ai-heading { font-size: 14.5px; color: var(--ai-md-text-2); }

/* ---------- 代码块（语言标签 + 复制按钮 + 横向滚动） ---------- */
.ai-code-block {
    margin: 8px 0;
    border-radius: 7px;
    overflow: hidden;
    background: var(--ai-md-code-bg);
}

.ai-code-block .ai-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 8px;
    background: var(--ai-md-code-head);
}

.ai-code-block .ai-code-lang {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: #8b95a7;
    position: static;
    background: none;
    border-radius: 0;
}

.ai-code-block .ai-code-copy {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.ai-code-block .ai-code-copy.is-done {
    background: rgba(7, 193, 96, 0.22);
}

.ai-code-block .ai-code-copy .ai-code-copy-text {
    font-size: 11px;
    line-height: 1.6;
    color: #c9d1d9;
}

.ai-code-block .ai-code-copy.is-done .ai-code-copy-text {
    color: #4ade80;
}

.ai-code-block .ai-code-scroll {
    width: 100%;
    overflow-x: auto;
}

/* 代码不折行：保住缩进结构，靠横向滚动查看 */
pre.ai-code-text {
    display: block;
    margin: 0;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 0;
    font-family: 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
    font-size: 12.5px;
    line-height: 1.65;
    color: var(--ai-md-code-text);
    white-space: pre;
    word-break: normal;
    overflow-wrap: normal;
    overflow: visible;
}

pre.ai-code-text code {
    background: none;
    padding: 0;
    border: none;
    font: inherit;
    color: inherit;
    white-space: pre;
}

/* ---------- 列表（多级嵌套 + 任务清单） ---------- */
ul.ai-list,
ol.ai-list {
    margin: 5px 0;
    padding-left: 0;
    list-style: none;
}

ul.ai-list > li.ai-list-item,
ol.ai-list > li.ai-list-item {
    position: relative;
    padding-left: 18px;
    margin-bottom: 4px;
    line-height: 1.7;
    list-style: none;
    color: var(--ai-md-text);
}

ul.ai-list > li.ai-list-item:last-child,
ol.ai-list > li.ai-list-item:last-child {
    margin-bottom: 0;
}

ul.ai-list > li.ai-list-level-0,
ol.ai-list > li.ai-list-level-0 { padding-left: 18px; }
ul.ai-list > li.ai-list-level-1,
ol.ai-list > li.ai-list-level-1 { padding-left: 32px; }
ul.ai-list > li.ai-list-level-2,
ol.ai-list > li.ai-list-level-2 { padding-left: 46px; }
ul.ai-list > li.ai-list-level-3,
ol.ai-list > li.ai-list-level-3 { padding-left: 60px; }

.ai-list .ai-list-marker {
    position: absolute;
    left: 0;
    top: 0;
    min-width: 11px;
    font-weight: 600;
    line-height: 1.7;
    color: var(--ai-md-accent);
}

.ai-list .ai-list-marker.is-task {
    width: 13px;
    height: 13px;
    min-width: 13px;
    margin-top: 3px;
    border-radius: 4px;
    border: 1px solid var(--ai-md-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-list .ai-task-box {
    font-size: 9px;
    line-height: 1;
    color: #ffffff;
}

.ai-list li.ai-list-level-1 .ai-list-marker,
.ai-list li.ai-list-level-2 .ai-list-marker,
.ai-list li.ai-list-level-3 .ai-list-marker {
    color: var(--ai-md-text-2);
    font-weight: 400;
}

.ai-list li.is-done .ai-list-marker.is-task {
    background: var(--ai-md-done);
    border-color: var(--ai-md-done);
}

.ai-list li.is-done .ai-inline,
.ai-list li.is-done strong {
    color: var(--ai-md-text-2);
    text-decoration: line-through;
}

/* ---------- 表格（列宽由渲染器按内容给出，表头与内容严格对齐） ---------- */
.ai-table-wrap {
    margin: 8px 0;
    border: 1px solid var(--ai-md-border);
    border-radius: 6px;
    overflow: hidden;
}

.ai-table-wrap .ai-table-scroll {
    width: 100%;
    overflow-x: auto;
}

table.ai-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

table.ai-table th.ai-table-cell,
table.ai-table td.ai-table-cell {
    padding: 6px 8px;
    font-size: 13px;
    line-height: 1.6;
    text-align: left;
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    color: var(--ai-md-text);
    border: none;
    border-right: 1px solid var(--ai-md-divider);
    border-bottom: 1px solid var(--ai-md-divider);
}

table.ai-table th.ai-table-cell {
    font-weight: 600;
    background: rgba(148, 163, 184, 0.08);
}

table.ai-table tr.ai-table-row:last-child td.ai-table-cell {
    border-bottom: none;
}

table.ai-table th.ai-table-cell:last-child,
table.ai-table td.ai-table-cell:last-child {
    border-right: none;
}

table.ai-table th.ai-table-cell.ai-align-center,
table.ai-table td.ai-table-cell.ai-align-center {
    text-align: center;
}

table.ai-table th.ai-table-cell.ai-align-right,
table.ai-table td.ai-table-cell.ai-align-right {
    text-align: right;
}

table.ai-table tr.ai-table-row:nth-child(even):not(.ai-table-head) td.ai-table-cell {
    background: rgba(148, 163, 184, 0.05);
}

[data-theme="dark"] table.ai-table th.ai-table-cell {
    background: rgba(148, 163, 184, 0.14);
}

[data-theme="dark"] table.ai-table tr.ai-table-row:nth-child(even):not(.ai-table-head) td.ai-table-cell {
    background: rgba(148, 163, 184, 0.07);
}

/* ---------- 引用 / 分割线 / 图片 ---------- */
blockquote.ai-quote {
    margin: 7px 0;
    padding: 7px 10px;
    border: none;
    border-left: 3px solid var(--ai-md-quote-bar);
    background: var(--ai-md-quote-bg);
    border-radius: 4px;
    color: var(--ai-md-quote-text);
}

hr.ai-divider {
    height: 1px;
    margin: 10px 0;
    border: none;
    background: var(--ai-md-border);
}

img.ai-image,
img.ai-inline-image {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 6px 0;
    border-radius: 6px;
}

/* ---------- 跳转按钮 ---------- */
a.ai-nav-inline {
    display: inline-block;
    margin: 0 3px;
    padding: 3px 10px;
    border: 1px solid var(--ai-md-accent);
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--ai-md-accent);
    background: var(--ai-md-quote-bg);
    text-decoration: none;
}

.ai-nav-btn .ai-nav-arrow {
    font-size: 14px;
    margin-left: 4px;
}

