/* ==================== 布局 ==================== */
.ls-aichat-wrap {
    display: flex;
    height: calc(100vh - var(--ls-header-height, 64px));
    background: #fff;
    overflow: hidden;
}

/* ==================== 侧边栏 ==================== */
.ls-aichat-sidebar {
    width: 260px;
    min-width: 260px;
    background: #f9fafb;
    border-right: 1px solid #eef0f2;
    display: flex;
    flex-direction: column;
}

.ls-aichat-sidebar-header {
    padding: 14px 12px;
}

.ls-aichat-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 9px 0;
    border-radius: 8px;
    border: 1px solid #e0e3e8;
    color: #344054;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    background: #fff;
}

.ls-aichat-new-btn:hover {
    border-color: #c7ccd4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.ls-aichat-new-btn i { font-size: 16px; }

/* 会话列表 */
.ls-aichat-conv-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 8px;
}

.ls-aichat-conv-list::-webkit-scrollbar { width: 3px; }
.ls-aichat-conv-list::-webkit-scrollbar-thumb { background: #d5d9de; border-radius: 3px; }

.ls-aichat-conv-empty {
    text-align: center;
    padding: 48px 20px;
    color: #b0b8c4;
}

.ls-aichat-conv-empty i { font-size: 32px; display: block; margin-bottom: 8px; opacity: 0.6; }
.ls-aichat-conv-empty p { margin: 0; font-size: 13px; }

.ls-aichat-conv-item {
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    margin-bottom: 1px;
    position: relative;
}

.ls-aichat-conv-item:hover { background: #eef0f3; }
.ls-aichat-conv-item.active { background: #e8ebef; }

.ls-aichat-conv-icon {
    font-size: 15px;
    color: #98a2b3;
    margin-right: 8px;
    flex-shrink: 0;
}

.ls-aichat-conv-item.active .ls-aichat-conv-icon { color: #475467; }

.ls-aichat-conv-title {
    flex: 1;
    font-size: 13px;
    color: #475467;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.ls-aichat-conv-item.active .ls-aichat-conv-title { color: #1d2939; font-weight: 500; }

.ls-aichat-conv-actions {
    display: none;
    align-items: center;
    gap: 1px;
    flex-shrink: 0;
    margin-left: 4px;
}

.ls-aichat-conv-item:hover .ls-aichat-conv-actions { display: flex; }

.ls-aichat-conv-actions a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    color: #98a2b3;
    text-decoration: none;
    transition: all 0.12s;
}

.ls-aichat-conv-actions a:hover { background: #dde0e5; color: #374151; }
.ls-aichat-conv-actions .ls-aichat-conv-delete:hover { background: #fee2e2; color: #dc2626; }
.ls-aichat-conv-actions a i { font-size: 13px; }

/* ==================== 侧边栏底部 ==================== */
.ls-aichat-sidebar-footer {
    padding: 6px 12px 10px;
    border-top: 1px solid #eef0f2;
    flex-shrink: 0;
}

/* 侧边栏余额 */
.ls-aichat-sidebar-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 12px;
    color: #667085;
}

.ls-aichat-sidebar-balance i { font-size: 15px; color: #98a2b3; }
.ls-aichat-sidebar-balance span { flex: 1; }
.ls-aichat-sidebar-balance strong { color: #1d2939; font-weight: 600; font-size: 13px; }

/* 侧边栏操作项 */
.ls-aichat-sidebar-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    color: #98a2b3;
    text-decoration: none;
    transition: all 0.12s;
}

.ls-aichat-sidebar-action:hover { color: #475467; background: #f3f4f6; }
.ls-aichat-sidebar-action.ls-aichat-clear-all:hover { color: #dc2626; background: #fef2f2; }
.ls-aichat-sidebar-action i { font-size: 15px; }

.ls-aichat-stats-token-badge {
    margin-left: auto;
    font-size: 11px;
    color: #b0b8c4;
    font-weight: 400;
}

/* ==================== 主区域 ==================== */
.ls-aichat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #fff;
    position: relative;
}

/* ==================== 消息区域 ==================== */
.ls-aichat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.ls-aichat-messages::-webkit-scrollbar { width: 5px; }
.ls-aichat-messages::-webkit-scrollbar-thumb { background: #dde0e5; border-radius: 5px; }
.ls-aichat-messages::-webkit-scrollbar-thumb:hover { background: #c7ccd4; }

/* ==================== 欢迎页 ==================== */
.ls-aichat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: 60px 40px;
    text-align: center;
}

.ls-aichat-welcome-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: var(--ls-aichat-primary, #667eea);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.ls-aichat-welcome-icon i { font-size: 30px; color: #fff; }

.ls-aichat-welcome-icon.is-image {
    width: auto;
    height: auto;
    max-width: 200px;
    max-height: 80px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.ls-aichat-welcome-icon.is-image img {
    max-width: 200px;
    max-height: 80px;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

.ls-aichat-welcome h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1d2939;
    margin: 0 0 8px;
}

.ls-aichat-welcome p {
    font-size: 14px;
    color: #667085;
    margin: 0 0 32px;
    max-width: 400px;
    line-height: 1.6;
}

.ls-aichat-welcome-tips {
    display: flex;
    gap: 12px;
}

.ls-aichat-tip-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f9fafb;
    border: 1px solid #eef0f2;
    border-radius: 8px;
    font-size: 13px;
    color: #475467;
    transition: border-color 0.15s;
}

.ls-aichat-tip-item:hover { border-color: #d0d5dd; }
.ls-aichat-tip-item i { font-size: 16px; color: var(--ls-aichat-primary, #667eea); }

/* ==================== 消息条目 ==================== */
.ls-aichat-msg {
    padding: 24px 0;
}

/* AI 消息 */
.ls-aichat-msg-assistant {
    background: #f9fafb;
}

.ls-aichat-msg-inner {
    max-width: 780px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    gap: 14px;
}

/* 头像 */
.ls-aichat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    overflow: hidden;
}

.ls-aichat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.ls-aichat-msg-user .ls-aichat-msg-avatar {
    background: #eef0f3;
    color: #475467;
}

.ls-aichat-msg-assistant .ls-aichat-msg-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ls-aichat-msg-body {
    flex: 1;
    min-width: 0;
    padding-top: 2px;
}

.ls-aichat-msg-role {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 4px;
    line-height: 1;
}

.ls-aichat-msg-content {
    font-size: 14px;
    line-height: 1.75;
    color: #344054;
    word-break: break-word;
}

/* ==================== Markdown 内容 ==================== */
.ls-aichat-msg-content p { margin: 0 0 8px; }
.ls-aichat-msg-content p:last-child { margin-bottom: 0; }

.ls-aichat-msg-content pre {
    background: #1e293b;
    border-radius: 8px;
    padding: 14px 16px;
    overflow-x: auto;
    margin: 10px 0;
    line-height: 1;
}

.ls-aichat-msg-content pre code {
    font-size: 13px;
    line-height: 1.65;
    color: #e2e8f0;
    background: transparent;
    padding: 0;
    display: block;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}

/* pre 在 code-block 容器内时去掉自身 margin 和圆角（由容器控制） */
.ls-aichat-code-block pre {
    margin: 0;
    border-radius: 0;
}

.ls-aichat-msg-content code {
    font-size: 13px;
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 4px;
    color: #c4432b;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, Monaco, monospace;
}

.ls-aichat-msg-content ul,
.ls-aichat-msg-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ls-aichat-msg-content li { margin-bottom: 4px; }

.ls-aichat-msg-content blockquote {
    border-left: 3px solid #d0d5dd;
    margin: 8px 0;
    padding: 4px 14px;
    color: #667085;
    background: #f9fafb;
    border-radius: 0 6px 6px 0;
}

.ls-aichat-msg-content table {
    border-collapse: collapse;
    margin: 10px 0;
    width: 100%;
}

.ls-aichat-msg-content th,
.ls-aichat-msg-content td {
    border: 1px solid #e5e7eb;
    padding: 8px 12px;
    text-align: left;
    font-size: 13px;
}

.ls-aichat-msg-content th { background: #f9fafb; font-weight: 600; }

.ls-aichat-msg-content h1,
.ls-aichat-msg-content h2,
.ls-aichat-msg-content h3 {
    margin: 16px 0 8px;
    font-weight: 600;
    color: #1d2939;
}

.ls-aichat-msg-content h1 { font-size: 18px; }
.ls-aichat-msg-content h2 { font-size: 16px; }
.ls-aichat-msg-content h3 { font-size: 15px; }

.ls-aichat-msg-content a { color: #667eea; text-decoration: none; }
.ls-aichat-msg-content a:hover { text-decoration: underline; }

.ls-aichat-msg-content hr {
    border: none;
    border-top: 1px solid #eef0f2;
    margin: 16px 0;
}

/* 代码块头部 */
.ls-aichat-code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: #334155;
    border-radius: 8px 8px 0 0;
    font-size: 12px;
    color: #94a3b8;
}

.ls-aichat-code-copy {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ls-aichat-code-copy:hover { background: rgba(255, 255, 255, 0.08); color: #e2e8f0; }

/* 打字光标 */
.ls-aichat-cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background: #667eea;
    margin-left: 1px;
    vertical-align: text-bottom;
    animation: ls-aichat-blink 1s step-end infinite;
}

@keyframes ls-aichat-blink {
    50% { opacity: 0; }
}

/* 加载动画 */
.ls-aichat-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 0;
}

.ls-aichat-typing-dot {
    width: 6px;
    height: 6px;
    background: #b0b8c4;
    border-radius: 50%;
    animation: ls-aichat-bounce 1.4s ease-in-out infinite;
}

.ls-aichat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ls-aichat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ls-aichat-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ==================== 输入区域 ==================== */
.ls-aichat-input-wrap {
    padding: 12px 40px 16px;
    background: #fff;
    flex-shrink: 0;
    border-top: 1px solid #eef0f2;
}

.ls-aichat-input-box {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #fff;
    border: 1px solid #dde0e5;
    border-radius: 14px;
    padding: 10px 12px 10px 18px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ls-aichat-input-box:focus-within {
    border-color: #b0b8f8;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.08);
}

/* 拖拽图片高亮 */
.ls-aichat-input-wrap.ls-aichat-dragover .ls-aichat-input-box {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
    background: #f8f9ff;
}

#ls-aichat-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    line-height: 22px;
    color: #1d2939;
    resize: none;
    max-height: 150px;
    min-height: 22px;
    background: transparent;
    font-family: inherit;
    padding: 4px 0;
}

#ls-aichat-input::placeholder { color: #b0b8c4; }

/* 字数统计（输入框内右侧） */
.ls-aichat-char-count {
    font-size: 11px;
    color: #ccd0d7;
    flex-shrink: 0;
    align-self: flex-end;
    padding-bottom: 6px;
    line-height: 1;
    transition: color 0.15s;
    user-select: none;
}

.ls-aichat-char-count.ls-aichat-char-warn { color: #f59e0b; }
.ls-aichat-char-count.ls-aichat-char-over { color: #ef4444; font-weight: 500; }

.ls-aichat-send-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    border: none;
    background: #667eea;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.12s;
}

.ls-aichat-send-btn:hover:not(:disabled) { background: #5a6fd6; }
.ls-aichat-send-btn:disabled { background: #dde0e5; cursor: not-allowed; }
.ls-aichat-send-btn i { font-size: 17px; font-weight: bold; }

.ls-aichat-send-btn.ls-aichat-sending { background: #ef4444; }
.ls-aichat-send-btn.ls-aichat-sending:hover { background: #dc2626; }

/* 滚动到底部按钮 */
.ls-aichat-scroll-bottom {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #dde0e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.15s;
    color: #667085;
}

.ls-aichat-scroll-bottom:hover {
    border-color: #b0b8f8;
    color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15);
}

.ls-aichat-scroll-bottom.ls-aichat-show { display: flex; }
.ls-aichat-scroll-bottom i { font-size: 18px; }

/* ==================== 侧边栏搜索 ==================== */
.ls-aichat-search-wrap {
    padding: 0 12px 8px;
}

.ls-aichat-search-box {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 7px;
    transition: border-color 0.15s;
}

.ls-aichat-search-box:focus-within { border-color: #b0b8f8; }
.ls-aichat-search-box i { font-size: 14px; color: #98a2b3; flex-shrink: 0; }

.ls-aichat-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 12px;
    color: #344054;
    background: transparent;
    font-family: inherit;
}

.ls-aichat-search-input::placeholder { color: #b0b8c4; }

/* ==================== 导出按钮 ==================== */
.ls-aichat-export-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    color: #b0b8c4;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.ls-aichat-export-btn:hover { background: #eef0f3; color: #475467; }

/* ==================== 代码块折叠 ==================== */
.ls-aichat-code-block { position: relative; margin: 10px 0; border-radius: 8px; overflow: hidden; }

.ls-aichat-code-block.ls-aichat-code-collapsed pre {
    max-height: 160px;
    overflow: hidden;
}

.ls-aichat-code-block.ls-aichat-code-collapsed .ls-aichat-code-toggle-expand { display: flex; }
.ls-aichat-code-block:not(.ls-aichat-code-collapsed) .ls-aichat-code-toggle-collapse { display: flex; }

/* 展开按钮（折叠态显示，绝对定位在底部） */
.ls-aichat-code-toggle-expand {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(to bottom, rgba(30,41,59,0) 0%, rgba(30,41,59,0.95) 70%);
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    cursor: pointer;
    z-index: 1;
}

/* 折叠按钮（展开态显示，在 pre 下方） */
.ls-aichat-code-toggle-collapse {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 5px 0;
    background: #1e293b;
    cursor: pointer;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-radius: 0 0 8px 8px;
}

.ls-aichat-code-toggle-expand span,
.ls-aichat-code-toggle-collapse span {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    transition: color 0.12s;
}

.ls-aichat-code-toggle-expand:hover span,
.ls-aichat-code-toggle-collapse:hover span { color: #e2e8f0; }

.ls-aichat-code-toggle-expand i,
.ls-aichat-code-toggle-collapse i { font-size: 14px; }

/* ==================== 消息时间戳 ==================== */
.ls-aichat-msg-time {
    font-size: 11px;
    color: #b0b8c4;
    margin-left: 8px;
    font-weight: 400;
}

/* ==================== 编辑用户消息 ==================== */
.ls-aichat-edit-btn { }
.ls-aichat-edit-wrap {
    margin-top: 6px;
}

.ls-aichat-edit-textarea {
    width: 100%;
    border: 1px solid #dde0e5;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.6;
    color: #1d2939;
    resize: none;
    outline: none;
    font-family: inherit;
    min-height: 40px;
    max-height: 200px;
    background: #fff;
    transition: border-color 0.15s;
}

.ls-aichat-edit-textarea:focus { border-color: #b0b8f8; }

.ls-aichat-edit-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.ls-aichat-edit-save,
.ls-aichat-edit-cancel {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.12s;
}

.ls-aichat-edit-save {
    background: #667eea;
    color: #fff;
}

.ls-aichat-edit-save:hover { background: #5a6fd6; }

.ls-aichat-edit-cancel {
    background: #f3f4f6;
    color: #667085;
}

.ls-aichat-edit-cancel:hover { background: #e5e7eb; }

/* ==================== AI 消息字数 / 耗时 ==================== */
.ls-aichat-msg-wordcount {
    font-size: 11px;
    color: #b0b8c4;
    margin-left: auto;
}

.ls-aichat-msg-duration {
    font-size: 11px;
    color: #b0b8c4;
    margin-left: 6px;
}

/* ==================== 侧边栏折叠 ==================== */
.ls-aichat-sidebar-toggle {
    position: absolute;
    top: 50%;
    left: 260px;
    transform: translateY(-50%);
    width: 16px;
    height: 40px;
    background: #f0f1f3;
    border: 1px solid #e0e3e8;
    border-left: none;
    border-radius: 0 6px 6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background 0.12s, left 0.25s;
    color: #98a2b3;
}

.ls-aichat-sidebar-toggle:hover { background: #e5e7eb; color: #475467; }
.ls-aichat-sidebar-toggle i { font-size: 14px; transition: transform 0.25s; }

.ls-aichat-wrap.ls-aichat-sidebar-hidden .ls-aichat-sidebar {
    width: 0;
    min-width: 0;
    overflow: hidden;
    border-right: none;
}

.ls-aichat-wrap.ls-aichat-sidebar-hidden .ls-aichat-sidebar-toggle {
    left: 0;
}

.ls-aichat-wrap.ls-aichat-sidebar-hidden .ls-aichat-sidebar-toggle i {
    transform: rotate(180deg);
}

.ls-aichat-sidebar {
    transition: width 0.25s, min-width 0.25s;
}

/* ==================== 欢迎页快捷提问 ==================== */
.ls-aichat-quick-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
    max-width: 480px;
}

.ls-aichat-quick-prompt {
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #eef0f2;
    border-radius: 10px;
    font-size: 13px;
    color: #475467;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.4;
}

.ls-aichat-quick-prompt:hover {
    border-color: #b0b8f8;
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.1);
    color: #344054;
}

.ls-aichat-quick-prompt i {
    font-size: 14px;
    color: var(--ls-aichat-primary, #667eea);
    margin-right: 6px;
}

/* ==================== 快捷键提示 ==================== */
.ls-aichat-shortcuts {
    position: absolute;
    bottom: 70px;
    right: 24px;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 10px;
    padding: 12px 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    z-index: 20;
    display: none;
    min-width: 200px;
}

.ls-aichat-shortcuts.ls-aichat-show { display: block; }

.ls-aichat-shortcuts-title {
    font-size: 12px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 8px;
}

.ls-aichat-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 12px;
    color: #667085;
}

.ls-aichat-shortcut-key {
    font-size: 11px;
    color: #475467;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #e0e3e8;
    font-family: inherit;
}

/* ==================== 思考过程 ==================== */
.ls-aichat-thinking {
    margin-bottom: 10px;
    border: 1px solid #eef0f2;
    border-radius: 8px;
    overflow: hidden;
}

.ls-aichat-thinking-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f9fafb;
    cursor: pointer;
    user-select: none;
    font-size: 12px;
    color: #667085;
    transition: background 0.12s;
}

.ls-aichat-thinking-header:hover { background: #f3f4f6; }
.ls-aichat-thinking-header i { font-size: 14px; color: #667eea; }

.ls-aichat-thinking-arrow {
    margin-left: auto;
    font-size: 12px;
    color: #98a2b3;
    transition: transform 0.2s;
}

.ls-aichat-thinking.ls-aichat-thinking-open .ls-aichat-thinking-arrow {
    transform: rotate(180deg);
}

.ls-aichat-thinking-body {
    display: none;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.7;
    color: #667085;
    border-top: 1px solid #eef0f2;
    white-space: pre-wrap;
    word-break: break-word;
}

.ls-aichat-thinking.ls-aichat-thinking-open .ls-aichat-thinking-body {
    display: block;
}

/* 思考中动画 */
.ls-aichat-thinking-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
    color: #667eea;
    background: #f5f7ff;
    border-radius: 8px;
    margin-bottom: 8px;
}

.ls-aichat-thinking-loading i {
    animation: ls-aichat-spin 1.5s linear infinite;
}

@keyframes ls-aichat-spin {
    to { transform: rotate(360deg); }
}

/* ==================== 消息操作 ==================== */
.ls-aichat-msg-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
    height: 26px;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.15s;
}

.ls-aichat-msg:hover .ls-aichat-msg-actions {
    visibility: visible;
    opacity: 1;
}

.ls-aichat-msg-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    color: #b0b8c4;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.ls-aichat-msg-action-btn:hover { background: #eef0f3; color: #475467; }
.ls-aichat-msg-action-btn i { font-size: 14px; }

/* 重新生成按钮（只在最后一条 AI 消息上显示） */
.ls-aichat-regenerate-btn {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #dde0e5;
    background: #fff;
    color: #667085;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.12s;
    margin-left: 4px;
}

.ls-aichat-regenerate-btn:hover { border-color: #667eea; color: #667eea; background: #f5f7ff; }
.ls-aichat-regenerate-btn i { font-size: 13px; }
.ls-aichat-msg:last-child .ls-aichat-regenerate-btn { display: flex; }

/* ==================== 重命名输入 ==================== */
.ls-aichat-rename-input {
    width: 100%;
    border: 1px solid #667eea;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 13px;
    outline: none;
    background: #fff;
    color: #344054;
}

/* ==================== 顶部工具栏 ==================== */
.ls-aichat-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    border-bottom: 1px solid #eef0f2;
    background: #fff;
    flex-shrink: 0;
    min-height: 40px;
}

/* Prompt 模板选择器 */
.ls-aichat-prompt-selector { position: relative; }

.ls-aichat-prompt-trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid #e0e3e8;
    border-radius: 7px;
    background: #fff;
    font-size: 12px;
    color: #344054;
    cursor: pointer;
    transition: border-color 0.12s;
}

.ls-aichat-prompt-trigger:hover { border-color: #b0b8f8; }
.ls-aichat-prompt-trigger i:first-child { font-size: 14px; color: var(--ls-aichat-primary, #667eea); }
.ls-aichat-prompt-trigger i:last-child { font-size: 12px; color: #98a2b3; }

.ls-aichat-prompt-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    z-index: 30;
    min-width: 240px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px;
}

.ls-aichat-prompt-dropdown.ls-aichat-show { display: block; }

.ls-aichat-prompt-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
}

.ls-aichat-prompt-option:hover { background: #f5f7ff; }
.ls-aichat-prompt-option.active { background: #eef2ff; }
.ls-aichat-prompt-option i { font-size: 16px; color: #667eea; margin-top: 1px; }
.ls-aichat-prompt-opt-name { font-size: 13px; color: #344054; font-weight: 500; }
.ls-aichat-prompt-opt-desc { font-size: 11px; color: #98a2b3; margin-top: 1px; }

/* 模型选择器 */
.ls-aichat-model-selector { position: relative; }
.ls-aichat-model-trigger {
    display: flex; align-items: center; gap: 5px; padding: 5px 10px;
    border: 1px solid #e5e7eb; border-radius: 6px; background: #fff;
    cursor: pointer; font-size: 12px; color: #374151; transition: border-color 0.15s; white-space: nowrap;
}
.ls-aichat-model-trigger:hover { border-color: #b0b8f8; }
.ls-aichat-model-trigger i:first-child { font-size: 14px; color: #667eea; }
.ls-aichat-model-trigger i:last-child { font-size: 12px; color: #98a2b3; }
#ls-aichat-model-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.ls-aichat-model-dropdown {
    display: none; position: absolute; top: 100%; left: 0; margin-top: 4px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    z-index: 100; min-width: 180px; max-height: 260px; overflow-y: auto; padding: 4px;
}
.ls-aichat-model-dropdown.ls-aichat-show { display: block; }
.ls-aichat-model-option {
    display: flex; align-items: center; gap: 6px; padding: 7px 10px;
    border-radius: 6px; cursor: pointer; font-size: 12px; color: #374151; transition: background 0.15s;
}
.ls-aichat-model-option:hover { background: #f3f4f6; }
.ls-aichat-model-option i { font-size: 14px; color: transparent; flex-shrink: 0; }
.ls-aichat-model-option.active i { color: #667eea; }
.ls-aichat-model-option.active { font-weight: 600; }

/* 上下文指示器 */
.ls-aichat-context-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #98a2b3;
    padding: 4px 8px;
    background: #f9fafb;
    border-radius: 6px;
}

.ls-aichat-context-indicator i { font-size: 13px; color: var(--ls-aichat-primary, #667eea); }

/* 额度指示器 */
.ls-aichat-quota-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #98a2b3;
    padding: 4px 8px;
    background: #f9fafb;
    border-radius: 6px;
    margin-left: auto;
}

.ls-aichat-quota-indicator i { font-size: 13px; color: #f59e0b; }

/* ==================== 消息内搜索 ==================== */
.ls-aichat-msg-search {
    background: #fff;
    border-bottom: 1px solid #eef0f2;
    padding: 6px 20px;
    flex-shrink: 0;
}

.ls-aichat-msg-search-inner {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 500px;
}

.ls-aichat-msg-search-inner i { font-size: 14px; color: #98a2b3; }

#ls-aichat-msg-search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 13px;
    color: #344054;
    background: transparent;
    font-family: inherit;
}

#ls-aichat-msg-search-input::placeholder { color: #b0b8c4; }
#ls-aichat-msg-search-count { font-size: 11px; color: #98a2b3; white-space: nowrap; }

.ls-aichat-msg-search-inner a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    color: #667085;
    text-decoration: none;
}

.ls-aichat-msg-search-inner a:hover { background: #eef0f3; }

/* 搜索高亮 */
.ls-aichat-highlight { background: #fef08a; border-radius: 2px; padding: 0 1px; }
.ls-aichat-highlight-current { background: #fb923c; color: #fff; }

/* ==================== 标签筛选 ==================== */
.ls-aichat-tag-filter {
    display: flex;
    gap: 4px;
    padding: 0 12px 8px;
    flex-wrap: wrap;
}

.ls-aichat-tag-chip {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    text-decoration: none;
    color: #667085;
    background: #f3f4f6;
    transition: all 0.12s;
    white-space: nowrap;
}

.ls-aichat-tag-chip:hover { background: #e5e7eb; }
.ls-aichat-tag-chip.active { background: var(--ls-aichat-primary, #667eea); color: #fff; }
.ls-aichat-tag-chip[data-tag]:not([data-tag=""]).active {
    background: var(--tag-color, var(--ls-aichat-primary, #667eea));
    color: #fff;
}

/* ==================== 图片预览 ==================== */
.ls-aichat-image-preview {
    padding: 8px 40px 0;
    flex-shrink: 0;
}

.ls-aichat-image-preview-list {
    display: flex;
    gap: 8px;
    max-width: 780px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.ls-aichat-image-thumb {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #eef0f2;
}

.ls-aichat-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ls-aichat-image-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* 附件/语音按钮 */
.ls-aichat-attach-btn,
.ls-aichat-voice-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #98a2b3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.12s;
}

.ls-aichat-attach-btn:hover,
.ls-aichat-voice-btn:hover { background: #f3f4f6; color: #475467; }
.ls-aichat-attach-btn i,
.ls-aichat-voice-btn i { font-size: 18px; }

.ls-aichat-voice-btn.ls-aichat-recording {
    color: #ef4444;
    animation: ls-aichat-pulse 1.5s ease-in-out infinite;
}

@keyframes ls-aichat-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==================== 消息反馈 👍👎 ==================== */
.ls-aichat-feedback-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    color: #b0b8c4;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.ls-aichat-feedback-btn:hover { background: #eef0f3; color: #475467; }
.ls-aichat-feedback-btn i { font-size: 14px; }
.ls-aichat-feedback-btn.ls-aichat-fb-active-up { color: #667eea; }
.ls-aichat-feedback-btn.ls-aichat-fb-active-down { color: #ef4444; }

/* ==================== 分享按钮 ==================== */
.ls-aichat-share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 5px;
    color: #b0b8c4;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}

.ls-aichat-share-btn:hover { background: #eef0f3; color: #475467; }

/* ==================== 对话标签设置（右键菜单） ==================== */
.ls-aichat-conv-tag-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #e0e3e8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    z-index: 50;
    padding: 4px;
    min-width: 120px;
    display: none;
}

.ls-aichat-conv-tag-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #344054;
    cursor: pointer;
    transition: background 0.12s;
}

.ls-aichat-conv-tag-option:hover { background: #f5f7ff; }

.ls-aichat-tag-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* 会话列表标签小点 */
.ls-aichat-conv-tag-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-right: 6px;
}

/* ==================== 统计面板 ==================== */
.ls-aichat-stats-panel {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 100;
}

.ls-aichat-stats-mask {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.3);
}

.ls-aichat-stats-body {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 520px;
    max-height: 80vh;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.ls-aichat-stats-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eef0f2;
    font-size: 15px;
    font-weight: 600;
    color: #1d2939;
}

.ls-aichat-stats-close {
    color: #98a2b3;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
}

.ls-aichat-stats-close:hover { color: #475467; }

.ls-aichat-stats-content {
    padding: 20px;
    overflow-y: auto;
}

/* 统计卡片 */
.ls-aichat-stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.ls-aichat-stats-card {
    padding: 14px 16px;
    background: #f9fafb;
    border-radius: 10px;
}

.ls-aichat-stats-card-label {
    font-size: 12px;
    color: #98a2b3;
    margin-bottom: 4px;
}

.ls-aichat-stats-card-value {
    font-size: 22px;
    font-weight: 600;
    color: #1d2939;
}

.ls-aichat-stats-card-value small {
    font-size: 12px;
    font-weight: 400;
    color: #98a2b3;
    margin-left: 2px;
}

/* 趋势图 */
.ls-aichat-stats-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin-bottom: 12px;
}

.ls-aichat-stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding: 0 4px;
}

.ls-aichat-stats-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    height: 100%;
}

.ls-aichat-stats-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.ls-aichat-stats-bar {
    width: 100%;
    max-width: 32px;
    background: #667eea;
    border-radius: 4px 4px 0 0;
    min-height: 2px;
    transition: height 0.3s;
}

.ls-aichat-stats-bar-label {
    font-size: 10px;
    color: #98a2b3;
    white-space: nowrap;
}

.ls-aichat-stats-bar-val {
    font-size: 10px;
    color: #667085;
    text-align: center;
}

/* 余额不足提示条 */
.ls-aichat-insufficient-bar {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #fef2f2;
    border-top: 1px solid #fecaca;
    font-size: 13px;
    color: #991b1b;
}

.ls-aichat-insufficient-bar.ls-aichat-show { display: flex; }
.ls-aichat-insufficient-bar i { font-size: 16px; color: #ef4444; }
.ls-aichat-insufficient-bar a { color: #667eea; margin-left: auto; text-decoration: none; font-weight: 500; }
