/* 字体已移至 index.html <link> 标签，避免 @import 阻塞样式加载 */

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fb;
    --bg-sidebar: #f3f4f6;
    --text-primary: #1e1e2e;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --accent-color: #4f46e5;
    --accent-hover: #4338ca;
    --accent-light: #eef2ff;
    --user-msg-bg: linear-gradient(135deg, #4f46e5, #7c3aed);
    --user-msg-text: #ffffff;
    --ai-msg-bg: #f8f9fb;
    --ai-msg-text: #1e1e2e;
    --shadow: 0 1px 2px rgba(0,0,0,0.03), 0 4px 12px rgba(0,0,0,0.04);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.06), 0 20px 56px rgba(0,0,0,0.06);
    --radius: 12px;
    --radius-lg: 16px;
    --header-height: 60px;
    --input-area-height: 88px;
    --glass-bg: rgba(255,255,255,0.7);
    --glass-border: rgba(255,255,255,0.3);
    --gradient-accent: linear-gradient(135deg, #4f46e5, #7c3aed);
}

.dark-mode {
    --bg-primary: #0f1729;
    --bg-secondary: #111827;
    --bg-sidebar: #0d1321;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --border-color: #1e293b;
    --accent-color: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-light: #1e1b4b;
    --user-msg-bg: linear-gradient(135deg, #818cf8, #a78bfa);
    --user-msg-text: #ffffff;
    --ai-msg-bg: #1a2332;
    --ai-msg-text: #e2e8f0;
    --shadow: 0 1px 2px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.3), 0 20px 56px rgba(0,0,0,0.25);
    --glass-bg: rgba(15,23,41,0.75);
    --glass-border: rgba(30,41,59,0.5);
    --gradient-accent: linear-gradient(135deg, #818cf8, #a78bfa);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    transition: background 0.35s ease, color 0.35s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    display: flex;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* 侧边栏 */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, color-mix(in srgb, var(--bg-sidebar) 85%, black) 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
    width: 100%;
    padding: 12px 16px;
    background: var(--gradient-accent);
    color: white;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.new-chat-btn:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.new-chat-btn:active {
    transform: scale(0.97) translateY(0);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    -webkit-overflow-scrolling: touch;
    contain: layout style;
}

.chat-history-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 400;
    transition: all 0.2s ease;
    position: relative;
    touch-action: manipulation;
    contain: content; /* CSS containment 优化 */
}

.chat-history-item:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: translateX(1px);
}

.chat-history-item.active {
    background: var(--accent-light);
    color: var(--accent-color);
    font-weight: 500;
}

.chat-history-item .delete-btn {
    position: absolute;
    right: 6px;
    opacity: 0;
    transition: all 0.2s ease;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    touch-action: manipulation;
}

.chat-history-item:hover .delete-btn,
.chat-history-item .delete-btn.visible {
    opacity: 0.7;
}

.chat-history-item .delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.settings-btn {
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.settings-btn:hover {
    background: var(--bg-primary);
    color: var(--accent-color);
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.settings-btn:active {
    transform: scale(0.98);
}

/* 主内容区 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    background: var(--bg-secondary);
}

.chat-header {
    height: var(--header-height);
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.menu-btn:hover {
    background: var(--bg-secondary);
}

.chat-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.mode-toggle {
    display: flex;
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 3px;
    border: 1px solid var(--border-color);
    gap: 1px;
}

.mode-btn {
    padding: 7px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.mode-btn.active {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.mode-btn:not(.active):hover {
    color: var(--text-primary);
    background: rgba(0,0,0,0.03);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.icon-btn:active {
    transform: scale(0.95);
}

/* 消息区域 */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    text-align: center;
    gap: 24px;
    padding: 40px 20px;
    animation: fadeInUp 0.6s ease;
}

.welcome-icon {
    width: 72px;
    height: 72px;
    background: var(--gradient-accent);
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    box-shadow: 0 8px 32px rgba(79, 70, 229, 0.2);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.welcome-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.welcome-subtitle {
    color: var(--text-secondary);
    max-width: 420px;
    line-height: 1.7;
    font-size: 15px;
    font-weight: 400;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 520px;
    width: 100%;
    margin-top: 8px;
}

.quick-action-btn {
    padding: 18px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    text-align: left;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-primary);
    touch-action: manipulation;
    box-shadow: var(--shadow);
}

.quick-action-btn:hover {
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.1);
    transform: translateY(-2px);
}

.quick-action-btn:active {
    transform: scale(0.98) translateY(0);
}

.quick-action-btn .icon {
    font-size: 22px;
    margin-bottom: 10px;
    display: block;
}

.quick-action-btn .label {
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.quick-action-btn .desc {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 4px;
    line-height: 1.5;
    display: block;
}

.message {
    display: flex;
    gap: 14px;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    font-weight: 600;
}

.message.user .message-avatar {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.2);
    order: 2;
}

.message.ai .message-avatar {
    background: var(--accent-light);
    color: var(--accent-color);
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.message-content {
    flex: 1;
    padding: 18px 22px;
    border-radius: 20px;
    line-height: 1.75;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
    font-size: 15px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.message.user {
    flex-direction: row-reverse;
}

.message.user .message-content {
    background: var(--gradient-accent);
    color: var(--user-msg-text);
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.22), 0 1px 3px rgba(79, 70, 229, 0.15);
}

.message.ai .message-content {
    background: var(--ai-msg-bg);
    color: var(--ai-msg-text);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--accent-color);
}

.message-image {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 10px;
    display: block;
    cursor: zoom-in;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.message-image:hover {
    opacity: 0.92;
    transform: scale(1.01);
}

.message-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    opacity: 0;
    align-items: center;
    transition: opacity 0.25s ease;
}

.message:hover .message-actions,
.message-actions.visible {
    opacity: 1;
}

.msg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12.5px;
    border-radius: 8px;
    transition: all 0.2s ease;
    touch-action: manipulation;
    font-weight: 500;
    white-space: nowrap;
    line-height: 1.4;
    flex-shrink: 0;
}

.msg-action-btn:hover {
    background: var(--accent-light);
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.msg-action-btn:active {
    transform: scale(0.96);
}

.msg-action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* 用户消息按钮在彩色背景上的适配 */
.message.user .msg-action-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
}

.message.user .msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.message.user .message-actions {
    border-top-color: rgba(255, 255, 255, 0.2);
}

/* 输入区域 */
.input-area {
    padding: 16px 20px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.input-container {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-box {
    flex: 1;
    padding: 14px 18px;
    border: 1.5px solid var(--border-color);
    border-radius: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    line-height: 1.5;
    max-height: 150px;
    min-height: 48px;
}

.input-box::placeholder {
    color: var(--text-tertiary);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.input-box:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08), 0 0 20px rgba(79, 70, 229, 0.06);
    background: var(--bg-primary);
}

.send-btn {
    width: 48px;
    height: 48px;
    border: none;
    background: var(--gradient-accent);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    touch-action: manipulation;
    font-size: 18px;
}

.send-btn:hover {
    opacity: 0.9;
    transform: scale(1.06) rotate(-4deg);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
}

.send-btn:active {
    transform: scale(0.92);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-btn.generating {
    background: var(--text-secondary);
}
.send-btn.generating::before {
    content: '\25A0';
    font-size: 18px;
    color: white;
}
.send-btn.generating svg {
    display: none;
}

.upload-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    margin-bottom: 4px;
}

.upload-btn:hover {
    color: var(--accent-color);
    background: rgba(79, 70, 229, 0.06);
}

.file-preview-area {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 4px;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--accent-light);
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 20px;
    font-size: 12.5px;
    color: var(--accent-color);
    margin: 4px 4px 0 0;
    max-width: 200px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-chip-remove {
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0.7;
}

.file-chip-remove:hover {
    opacity: 1;
}

.input-hint {
    text-align: center;
    font-size: 11.5px;
    color: var(--text-tertiary);
    margin-top: 10px;
    font-weight: 400;
    letter-spacing: 0.2px;
}

/* 模型选择器 */
.model-selector {
    position: relative;
    flex-shrink: 0;
}

.model-select-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    touch-action: manipulation;
    white-space: nowrap;
}

.model-select-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.model-select-btn:active {
    transform: scale(0.97);
}

.dropdown-arrow {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.model-select-btn.open .dropdown-arrow {
    transform: rotate(180deg);
}

.model-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.model-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.model-option {
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.model-option:last-child {
    border-bottom: none;
}

.model-option:hover {
    background: var(--bg-secondary);
}

.model-option.active {
    background: var(--accent-light);
}

.model-option.active .model-name {
    color: var(--accent-color);
}

.model-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 3px;
}

/* 设置面板 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

.settings-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 420px;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: right 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.settings-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.settings-close {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.settings-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    -webkit-overflow-scrolling: touch;
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 14px;
}

.system-prompt-area {
    width: 100%;
    min-height: 80px;
    max-height: 200px;
    padding: 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.system-prompt-area:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}
.system-prompt-area::placeholder {
    color: var(--text-tertiary);
}

.provider-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.provider-tab {
    padding: 7px 16px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
}

.provider-tab:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.provider-tab.active {
    border-color: var(--accent-color);
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: all 0.25s ease;
    font-family: inherit;
}

/* API Key 输入框容器 */
.api-key-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.api-key-wrapper .form-input {
    padding-right: 42px;
}

.toggle-key-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-tertiary);
    font-size: 16px;
    line-height: 1;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-key-visibility:hover {
    color: var(--text-primary);
}

.form-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.06);
    background: var(--bg-primary);
}

.form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    line-height: 1.5;
}

.settings-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    touch-action: manipulation;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
}

.btn-primary:active {
    transform: scale(0.97) translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
    border-color: var(--text-tertiary);
}

.btn-secondary:active {
    transform: scale(0.97);
}

/* 加载动画 */
.typing-indicator {
    display: flex;
    gap: 6px;
    padding: 8px 0;
    align-items: center;
}

.typing-indicator .typing-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.typing-indicator .typing-text {
    color: var(--accent-color);
    font-size: 14px;
    font-weight: 500;
    margin-left: 10px;
    animation: typing-text-pulse 1.5s ease-in-out infinite;
}

@keyframes typing-text-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--gradient-accent);
    border-radius: 50%;
    animation: typing 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 6px rgba(79, 70, 229, 0.4);
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0) scale(1); opacity: 0.4; }
    30% { transform: translateY(-12px) scale(1.2); opacity: 1; }
}

/* 连接中状态 */
.connecting-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--accent-light);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin: 8px 0;
    animation: fadeInUp 0.3s ease;
}

.connecting-indicator .connecting-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.connecting-indicator .connecting-text {
    color: var(--accent-color);
    font-size: 13px;
    font-weight: 500;
}

/* 图片生成中 */
.image-generating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 32px;
    width: 100%;
}

.generating-progress-bar {
    width: 200px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.generating-progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 2px;
    width: 0%;
    transition: width 0.5s ease;
}

.generating-text {
    color: var(--text-secondary);
    font-size: 13px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-right-color: var(--accent-hover);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

/* 代码块包装器 */
.code-wrapper {
    margin: 10px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid transparent;
    background: linear-gradient(#0f172a, #0f172a) padding-box,
                linear-gradient(135deg, #4f46e5, #7c3aed, #4f46e5) border-box;
    background-origin: border-box;
    background-clip: padding-box, border-box;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e293b;
    font-size: 12px;
}

.code-lang {
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-actions {
    display: flex;
    gap: 4px;
}

.code-action-btn {
    padding: 4px 10px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.code-action-btn:hover {
    background: #334155;
    color: #e2e8f0;
}

/* 代码块样式 */
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 0;
    overflow-x: auto;
    font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    -webkit-overflow-scrolling: touch;
    box-shadow: none;
    border: none;
}

.code-block code {
    font-family: inherit;
}

/* 响应式 - 平板 */
@media (max-width: 1024px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 响应式 - 手机 */
@media (max-width: 768px) {
    html {
        font-size: 15px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        transform: translateX(-100%);
        z-index: 100;
        height: 100vh;
        height: 100dvh;
        box-shadow: var(--shadow-lg);
        width: 280px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .menu-btn {
        display: flex;
    }

    .chat-header {
        padding: 0 14px;
        height: 56px;
    }

    .chat-title {
        font-size: 15px;
    }

    .mode-toggle {
        padding: 2px;
    }

    .mode-btn {
        padding: 7px 14px;
        font-size: 13px;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }

    .chat-messages {
        padding: 16px 14px;
        gap: 16px;
    }

    .welcome-screen {
        gap: 20px;
        padding: 24px 16px;
    }

    .welcome-icon {
        width: 60px;
        height: 60px;
        font-size: 26px;
        border-radius: 16px;
    }

    .welcome-title {
        font-size: 26px;
    }

    .welcome-subtitle {
        font-size: 14px;
    }

    .quick-actions {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 8px;
    }

    .quick-action-btn {
        padding: 14px;
        border-radius: 12px;
    }

    .quick-action-btn .icon {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .quick-action-btn .label {
        font-size: 13px;
    }

    .quick-action-btn .desc {
        font-size: 12px;
    }

    .message {
        gap: 10px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .message-content {
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 16px;
    }

    .input-area {
        padding: 12px 14px;
    }

    .input-container {
        gap: 8px;
    }

    .input-box {
        padding: 12px 16px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 24px;
    }

    .input-box::placeholder {
        font-size: 12px;
    }

    .send-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
    }

    .upload-btn {
        width: 36px;
        height: 36px;
    }

    .input-hint {
        font-size: 11px;
        margin-top: 8px;
    }

    .settings-panel {
        width: 100%;
        right: -100%;
    }

    .settings-content {
        padding: 20px;
    }

    .provider-tabs {
        gap: 6px;
    }

    .provider-tab {
        padding: 7px 14px;
        font-size: 13px;
    }

    .form-input {
        padding: 11px 13px;
        font-size: 16px;
    }

    .message-actions {
        opacity: 1;
    }

    .msg-action-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .chat-history-item .delete-btn {
        opacity: 1;
        padding: 8px;
    }
}

/* 小屏幕手机 */
@media (max-width: 380px) {
    .mode-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .welcome-title {
        font-size: 22px;
    }

    .quick-action-btn {
        padding: 12px;
    }

    .settings-panel-collapsible {
        margin-left: -4px;
        margin-right: -4px;
    }

    .option-btn {
        padding: 5px 12px;
        font-size: 11px;
    }

    .input-box {
        padding: 10px 14px;
    }

    .send-btn {
        width: 44px;
        height: 44px;
    }
}

/* 图片/视频设置面板 */
.settings-panel-collapsible {
    max-width: 800px;
    margin: 0 auto 10px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
}

.settings-panel-collapsible.collapsed .settings-panel-body {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: all 0.2s ease;
}

.settings-panel-header:hover {
    background: var(--bg-secondary);
}

.settings-panel-header .panel-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-panel-header .panel-arrow {
    font-size: 11px;
    color: var(--text-tertiary);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-panel-collapsible.collapsed .panel-arrow {
    transform: rotate(-90deg);
}

.settings-panel-body {
    max-height: 500px;
    padding: 0 16px 14px;
    opacity: 1;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.option-group {
    margin-bottom: 12px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.option-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    font-weight: 500;
}

.option-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.option-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    touch-action: manipulation;
    white-space: nowrap;
}

.option-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--bg-primary);
}

.option-btn.active {
    background: var(--gradient-accent);
    color: white;
    border-color: transparent;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.2);
}

/* 视频消息样式 */
.message-video {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 10px;
    box-shadow: var(--shadow);
}

/* 图片预览模态框 */
.image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: all 0.35s ease;
}

.image-preview-overlay.open {
    opacity: 1;
    visibility: visible;
}

.image-preview-overlay img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 12px;
    transform: scale(0.85);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 24px 64px rgba(0,0,0,0.4);
}

.image-preview-overlay.open img {
    transform: scale(1);
}

/* 视频生成进度条 */
.video-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.video-progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
}

.video-progress-text {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    font-weight: 500;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.12);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.2);
}

/* 安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .input-area {
        padding-bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .settings-footer {
        padding-bottom: calc(18px + env(safe-area-inset-bottom));
    }
}

/* 文档生成弹窗 */
.doc-gen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.doc-gen-overlay.open {
    opacity: 1;
    visibility: visible;
}

.doc-gen-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.doc-gen-overlay.open .doc-gen-panel {
    transform: scale(1);
}

.doc-gen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}

.doc-gen-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.doc-gen-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.doc-gen-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.doc-gen-body {
    padding: 20px;
}

.doc-gen-body > .doc-gen-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.doc-gen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.doc-gen-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.doc-gen-option:hover {
    border-color: var(--accent-color);
    background: var(--accent-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.doc-gen-icon {
    font-size: 28px;
}

.doc-gen-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.doc-gen-option .doc-gen-desc {
    font-size: 11px;
    color: var(--text-tertiary);
    margin: 0;
    text-align: center;
}

@media (max-width: 768px) {
    .doc-gen-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* 文件卡片 */
.file-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    margin-top: 8px;
}

.file-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.file-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.file-download-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--accent-color);
    flex-shrink: 0;
    transition: all 0.2s;
}

.file-card:hover .file-download-btn {
    background: var(--accent-color);
    color: white;
}
/* ========== 并行对话模式 ========== */
.parallel-response {
    max-width: 100%;
    width: 100%;
    margin: 8px auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 14px;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.parallel-slot {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 16px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s ease;
}
.parallel-slot:hover {
    box-shadow: var(--shadow, 0 4px 12px rgba(0,0,0,0.08));
}
.slot-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
}
.slot-model-info {
    display: flex;
    align-items: center;
    gap: 8px;
}
.slot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}
.slot-provider {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}
.slot-model {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
}
.slot-status {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 5px;
}
.slot-status .typing-dots {
    display: inline-flex;
    gap: 4px;
}
.slot-status .typing-dot {
    width: 5px;
    height: 5px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typing 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
}
.slot-status .typing-dot:nth-child(2) { animation-delay: 0.15s; }
.slot-status .typing-dot:nth-child(3) { animation-delay: 0.3s; }
.status-streaming { color: var(--accent-color); }
.status-done { color: #10b981; }
.status-error { color: #ef4444; }
.status-aborted { color: var(--text-tertiary); }
.slot-content {
    padding: 14px;
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    -webkit-overflow-scrolling: touch;
}
.slot-content code {
    background: var(--bg-secondary);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}
.slot-content pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    margin: 8px 0;
}
.slot-actions {
    padding: 8px 14px 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 6px;
}
/* 并行配置面板 */
.parallel-config-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}
.parallel-config-slot:last-of-type { border-bottom: none; }
.parallel-config-slot .slot-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--accent-light, rgba(79,70,229,0.1));
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.parallel-config-slot select {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius, 8px);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    outline: none;
}
.parallel-config-slot select:focus {
    border-color: var(--accent-color);
}
.enable-toggle {
    width: 34px;
    height: 18px;
    border-radius: 9px;
    background: var(--border-color);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.enable-toggle.active { background: var(--accent-color); }
.enable-toggle::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}
.enable-toggle.active::after { transform: translateX(16px); }
.add-slot-btn {
    width: 100%;
    padding: 8px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
    transition: all 0.2s;
}
.add-slot-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: var(--accent-light, rgba(79,70,229,0.05));
}
.remove-slot-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.remove-slot-btn:hover {
    background: rgba(239,68,68,0.1);
    color: #ef4444;
}
/* 响应式 */
@media (max-width: 1024px) {
    .parallel-response { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .parallel-response { grid-template-columns: 1fr; gap: 10px; }
    .slot-content { max-height: 400px; }
    .parallel-config-slot { flex-wrap: wrap; }
    .parallel-config-slot select { flex: 1 1 calc(50% - 4px); }
}
@media (max-width: 480px) {
    .parallel-config-slot select { flex: 1 1 100%; }
}

/* 网络状态提示条 */
.network-offline-banner {
    max-width: 800px;
    margin: 0 auto 8px;
    padding: 8px 16px;
    background: #ef4444;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* 发送按钮断网禁用样式 */
.send-btn.offline-disabled {
    background: var(--text-tertiary) !important;
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.send-btn.offline-disabled:hover {
    opacity: 0.5;
    transform: none;
    box-shadow: none;
}

/* 消息时间戳 */
.message-timestamp {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
    text-align: right;
    line-height: 1.2;
}
.message.user .message-timestamp {
    color: rgba(255, 255, 255, 0.7);
}

/* Token 用量标签 */
.token-usage-label {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 4px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-left: auto;
    align-self: center;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.message.user .token-usage-label {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.85);
}

/* 全部历史记录弹层 */
.history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
}
.history-overlay.open {
    display: flex;
}
.history-panel {
    background: var(--bg-primary);
    border-radius: 20px;
    width: 460px;
    max-width: 92vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border-color);
}
.history-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}
.history-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.history-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
.history-tabs {
    display: flex;
    gap: 4px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    flex-shrink: 0;
}
.history-tab {
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.history-tab.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}
.history-tab:hover:not(.active) {
    background: var(--accent-light);
    color: var(--accent-color);
    border-color: var(--accent-color);
}
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    -webkit-overflow-scrolling: touch;
}
.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s ease;
    position: relative;
}
.history-item:hover {
    background: var(--bg-secondary);
}
.history-item-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.history-item-content {
    flex: 1;
    min-width: 0;
}
.history-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item-time {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.history-item .delete-btn {
    position: static;
    opacity: 0;
    transition: opacity 0.2s ease;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    flex-shrink: 0;
}
.history-item:hover .delete-btn {
    opacity: 0.7;
}
.history-item .delete-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}
.history-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* 存储清理说明弹窗 */
.cleanup-notice-panel {
    width: 380px;
}
.cleanup-notice-body {
    padding: 20px;
}
.cleanup-notice-footer {
    padding: 0 20px 20px;
}

/* 侧边栏搜索框 */
.sidebar-search {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border-color);
}
.sidebar-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s ease;
    font-family: inherit;
}
.sidebar-search-input:focus {
    border-color: var(--accent-color);
}
.sidebar-search-input::placeholder {
    color: var(--text-tertiary);
}