* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #343541;
    height: 100vh;
    display: flex;
    overflow: hidden;
}

/* 左侧边栏 - 对话列表 */
.sidebar {
    width: 260px;
    background: #202123;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #363739;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid #363739;
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #565869;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.new-chat-btn:hover {
    background: #2a2b32;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.conversation-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    cursor: pointer;
    color: #ececf1;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-left: 3px solid transparent;
}

.conversation-item:hover {
    background: #2a2b32;
}

.conversation-item.active {
    background: #343541;
    border-left-color: #19c37d;
}

.conversation-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.conversation-actions {
    display: none;
    gap: 4px;
    align-items: center;
    position: relative;
}

.conversation-item:hover .conversation-actions {
    display: flex;
}

.conversation-action-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: #acacbe;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
}

.conversation-action-btn:hover {
    background: #40414f;
    color: white;
}

/* 下拉菜单按钮 (三点) */
.conversation-menu-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    color: #8e8ea0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.conversation-menu-btn:hover {
    background: #40414f;
    color: #ececf1;
}

/* 下拉菜单容器 */
.conversation-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #2a2b32;
    border: 1px solid #40414f;
    border-radius: 6px;
    min-width: 140px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
    overflow: hidden;
    margin-top: 4px;
}

.conversation-dropdown.show {
    display: block;
}

.dropdown-item {
    padding: 10px 16px;
    color: #ececf1;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
}

.dropdown-icon,
.icon-img {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    display: block;
    filter: invert(0.85);
    opacity: 0.9;
}

.dropdown-item.danger .dropdown-icon {
    filter: invert(0.55) sepia(1) saturate(5) hue-rotate(320deg);
}

.dropdown-item:hover {
    background: #40414f;
}

.dropdown-item.danger {
    color: #f85149;
}

.dropdown-item.danger:hover {
    background: rgba(248, 81, 73, 0.15);
}

.dropdown-divider {
    height: 1px;
    background: #40414f;
    margin: 4px 0;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid #363739;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
    color: #ececf1;
    cursor: pointer;
}

.user-info:hover {
    background: #2a2b32;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    flex: 1;
    font-size: 14px;
}

/* 主区域 */
.main-area {
    display: flex;
    flex-direction: column;
    background: #343541;
    overflow: hidden;
    /* 消息区与输入框共用宽度 */
    --msg-aside-width: 96px;
    --msg-gap: 12px;
    --msg-h-padding: 20px;
    --msg-max-width: min(900px, calc(100% - var(--msg-aside-width) - var(--msg-gap) - 16px));
    --msg-lane-inset: calc(var(--msg-aside-width) + var(--msg-gap));
    --msg-lane-width: calc(100% - 2 * var(--msg-lane-inset));
}

.chat-header {
    height: 60px;
    background: #343541;
    border-bottom: 1px solid #565869;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
}

.chat-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-title {
    color: #ececf1;
    font-size: 16px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-provider-badge {
    flex-shrink: 0;
    padding: 4px 10px;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 12px;
    color: #acacbe;
    font-size: 12px;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.header-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #565869;
    border-radius: 6px;
    color: #ececf1;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn:hover {
    background: #40414f;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px var(--msg-h-padding);
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-height: 0;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #ececf1;
    text-align: center;
}

.welcome-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

.welcome-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 14px;
    color: #acacbe;
    margin-bottom: 30px;
}

.example-prompts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    max-width: 800px;
    width: 100%;
}

.example-prompt {
    padding: 16px;
    background: #444654;
    border: 1px solid #565869;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.example-prompt:hover {
    background: #4a4a5a;
}

.example-prompt-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.example-prompt-text {
    font-size: 13px;
    color: #acacbe;
}

/* 消息行：左右对齐 + 侧边预留区 */
.msg-row {
    display: flex;
    align-items: flex-start;
    width: 100%;
    gap: 12px;
}

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

.msg-row--assistant {
    justify-content: flex-start;
}

/* 预留区域：后续可插入卡片、操作按钮等 */
.msg-aside {
    flex: 0 0 var(--msg-aside-width);
    width: var(--msg-aside-width);
    min-width: var(--msg-aside-width);
}

.msg-block {
    flex: 0 1 auto;
    max-width: var(--msg-max-width);
    min-width: 0;
    width: max-content;
}

.msg-block--user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* 长内容贴右对齐且不超出可视区域 */
    margin-left: auto;
    overflow: hidden;
}

.msg-block--assistant {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    max-width: var(--msg-max-width);
}

/* 顶栏：头像 + 昵称 + 时间 */
.msg-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
    width: 100%;
}

.msg-row--user .msg-header {
    flex-direction: row;
    justify-content: flex-end;
}

.msg-row--assistant .msg-header {
    flex-direction: row;
    justify-content: flex-start;
}

.msg-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.msg-row--user .msg-header-text {
    align-items: flex-end;
    text-align: right;
}

.msg-row--assistant .msg-header-text {
    align-items: flex-start;
    text-align: left;
}

.msg-sender {
    font-size: 14px;
    font-weight: 600;
    color: #ececf1;
    line-height: 1.3;
}

.msg-time {
    font-size: 12px;
    color: #8e8ea0;
    line-height: 1.3;
}

.msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}

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

.msg-row--user .msg-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.msg-row--assistant .msg-avatar {
    background: #19c37d;
    color: white;
}

.msg-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

.msg-row--user .msg-body {
    align-items: flex-end;
    width: 100%;
}

.msg-row--assistant .msg-body {
    align-items: flex-start;
}

.msg-bubble {
    color: #ffffff;
    line-height: 1.6;
    font-size: 15px;
    border-radius: 10px;
    padding: 12px 16px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-break: break-word;
}

.msg-row--user .msg-bubble {
    width: max-content;
    max-width: 100%;
}

.msg-row--assistant .msg-bubble {
    width: 100%;
}

.msg-bubble--user {
    background: #40414f;
    border: 1px solid #565869;
}

.msg-bubble--assistant {
    background: #444654;
    border: 1px solid transparent;
}

/* Markdown 内容区（沿用 message-content 类名） */
.message-content {
    color: #ffffff;
    line-height: 1.6;
    font-size: 15px;
}

.message-content :where(p, li, td, th, strong, em, del) {
    color: #ffffff;
}

/* Markdown 样式 */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.25;
    color: #ffffff;
}

.message-content h1 { font-size: 2em; border-bottom: 1px solid #565869; padding-bottom: 0.3em; }
.message-content h2 { font-size: 1.5em; border-bottom: 1px solid #565869; padding-bottom: 0.3em; }
.message-content h3 { font-size: 1.25em; }
.message-content h4 { font-size: 1em; }
.message-content h5 { font-size: 0.875em; }
.message-content h6 { font-size: 0.85em; color: #8e8ea0; }

.message-content p {
    margin-top: 0;
    margin-bottom: 16px;
}

.message-content ul,
.message-content ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.message-content li {
    margin-bottom: 4px;
}

.message-content code {
    background: #2d2d2d;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #e6edf3;
}

.message-content :not(pre) > code {
    color: #e6edf3;
}

.message-content pre {
    background: #2d2d2d;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
    position: relative;
}

.message-content pre .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    background: #40414f;
    border: 1px solid #565869;
    border-radius: 4px;
    color: #ececf1;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.message-content pre:hover .copy-btn {
    opacity: 1;
}

.message-content pre .copy-btn:hover {
    background: #565869;
}

.message-content pre .copy-btn.copied {
    background: #19c37d;
    border-color: #19c37d;
}

.message-content pre code {
    background: none;
    padding: 0;
    font-size: 0.9em;
    line-height: 1.5;
}

.message-content blockquote {
    margin: 16px 0;
    padding-left: 16px;
    border-left: 4px solid #565869;
    color: #acacbe;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.message-content table th,
.message-content table td {
    border: 1px solid #565869;
    padding: 8px 12px;
    text-align: left;
}

.message-content table th {
    background: #2d2d2d;
    font-weight: 600;
    color: #ffffff;
}

.message-content a {
    color: #58a6ff;
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

.message-content hr {
    border: none;
    border-top: 1px solid #565869;
    margin: 24px 0;
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 8px 0;
}

/* 消息下方控制条（放置音频播放按钮） */
.message-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding-left: 4px;
}

.audio-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 3px;
    background: transparent;
    border: 1px solid transparent;
    color: #a1a1a1;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.15s ease;
    margin: 0;
    opacity: 0.85;
}
/* SVG 图标尺寸与颜色继承 */
.audio-play-btn svg {
    width: 20px;
    height: 20px;
    display: block;
    fill: currentColor;
}
/* 播放动画：均衡器柱状条上下律动 */
@keyframes eqBounce {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}
.audio-play-btn.playing .bar1 { animation: eqBounce 0.9s infinite ease-in-out; transform-origin: bottom; }
.audio-play-btn.playing .bar2 { animation: eqBounce 0.9s infinite ease-in-out 0.1s; transform-origin: bottom; }
.audio-play-btn.playing .bar3 { animation: eqBounce 0.9s infinite ease-in-out 0.2s; transform-origin: bottom; }
.audio-play-btn.playing .bar4 { animation: eqBounce 0.9s infinite ease-in-out 0.3s; transform-origin: bottom; }
.audio-play-btn:hover {
    border: 1px solid #19c37d;
    background: rgba(25, 195, 125, 0.05);
    opacity: 1;
}
.audio-play-btn.playing {
    border: 1px solid #19c37d;
    background: rgba(25, 195, 125, 0.1);
    color: #19c37d;
}
.audio-play-btn.playing:hover {
    background: rgba(25, 195, 125, 0.15);
}

/* 复制和重新生成按钮 */
.copy-message-btn,
.regenerate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 3px;
    background: transparent;
    border: 1px solid transparent;
    color: #a1a1a1;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s ease;
    margin: 0;
    opacity: 0.85;
}

.copy-message-btn svg,
.regenerate-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

.copy-message-btn:hover,
.regenerate-btn:hover {
    border: 1px solid #19c37d;
    background: rgba(25, 195, 125, 0.05);
    opacity: 1;
}

.copy-message-btn.copied {
    color: #19c37d;
    border: 1px solid #19c37d;
    background: rgba(25, 195, 125, 0.1);
}

.agent-panel {
    width: 100%;
    max-width: 100%;
    border: 1px solid #565869;
    border-radius: 10px;
    background: #343541;
    overflow: hidden;
}

.agent-panel-summary {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: #ececf1;
    cursor: pointer;
    text-align: left;
}

.agent-panel-summary:hover {
    background: rgba(255, 255, 255, 0.03);
}

.agent-panel-summary-leading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.agent-panel-chevron {
    width: 7px;
    height: 7px;
    border-right: 1.5px solid #acacbe;
    border-bottom: 1.5px solid #acacbe;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.agent-panel.is-expanded .agent-panel-chevron {
    transform: rotate(45deg);
}

.agent-panel-summary-text {
    font-size: 13px;
    font-weight: 600;
}

.agent-panel-summary-meta {
    font-size: 12px;
    color: #acacbe;
    flex-shrink: 0;
}

.agent-panel-body.agent-timeline {
    list-style: none;
    margin: 0;
    padding: 4px 12px 12px 8px;
}

.agent-timeline-item {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    position: relative;
}

.agent-timeline-item:not(.agent-timeline-item--last) .agent-timeline-rail::after {
    content: "";
    position: absolute;
    left: 13px;
    top: 22px;
    bottom: -6px;
    width: 1px;
    background: #565869;
}

.agent-timeline-rail {
    position: relative;
    display: flex;
    justify-content: center;
    padding-top: 6px;
}

.agent-timeline-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    z-index: 1;
    background: #40414f;
    border: 1px solid #565869;
    color: #acacbe;
}

.agent-timeline-dot--running {
    border-color: rgba(88, 166, 255, 0.45);
    background: rgba(88, 166, 255, 0.12);
}

.agent-timeline-dot--completed {
    border-color: rgba(25, 195, 125, 0.45);
    background: rgba(25, 195, 125, 0.12);
    color: #19c37d;
}

.agent-timeline-dot--error {
    border-color: rgba(248, 81, 73, 0.45);
    background: rgba(248, 81, 73, 0.12);
    color: #f85149;
}

.agent-spinner {
    width: 10px;
    height: 10px;
    border: 1.5px solid rgba(88, 166, 255, 0.25);
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: agent-spin 0.8s linear infinite;
}

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

.agent-timeline-card {
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.agent-timeline-card[open] {
    border-color: #4e505e;
    background: rgba(0, 0, 0, 0.12);
}

.agent-timeline-card-summary {
    list-style: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
    padding: 8px 10px;
    cursor: pointer;
}

.agent-timeline-card-summary::-webkit-details-marker {
    display: none;
}

.agent-timeline-card-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.agent-timeline-title {
    font-size: 13px;
    font-weight: 600;
    color: #ececf1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-timeline-status {
    font-size: 11px;
    flex-shrink: 0;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid transparent;
}

.agent-timeline-status--pending,
.agent-timeline-status--running {
    color: #58a6ff;
    border-color: rgba(88, 166, 255, 0.25);
    background: rgba(88, 166, 255, 0.08);
}

.agent-timeline-status--completed {
    color: #19c37d;
    border-color: rgba(25, 195, 125, 0.25);
    background: rgba(25, 195, 125, 0.08);
}

.agent-timeline-status--error {
    color: #f85149;
    border-color: rgba(248, 81, 73, 0.25);
    background: rgba(248, 81, 73, 0.08);
}

.agent-timeline-round {
    font-size: 11px;
    color: #8e8ea0;
}

.agent-timeline-preview {
    font-size: 12px;
    line-height: 1.45;
    color: #8e8ea0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-timeline-card[open] .agent-timeline-preview {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.agent-timeline-card-body {
    padding: 0 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-tool-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agent-tool-section-title {
    font-size: 12px;
    color: #acacbe;
}

.agent-tool-pre {
    margin: 0;
    padding: 10px 12px;
    background: #2b2c36;
    border: 1px solid #444654;
    border-radius: 8px;
    color: #dfe6ee;
    font-size: 12px;
    line-height: 1.55;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #8e8ea0;
    display: flex;
    gap: 12px;
}

/* 输入区域：横跨左侧 AI 与右侧用户消息的可视宽度 */
.input-area {
    padding: 16px var(--msg-h-padding) 20px;
    background: #343541;
    border-top: 1px solid #565869;
    flex-shrink: 0;
}

.input-container {
    width: var(--msg-lane-width);
    max-width: none;
    margin-left: var(--msg-lane-inset);
    margin-right: var(--msg-lane-inset);
    position: relative;
}

.composer {
    display: flex;
    flex-direction: column;
    background: #40414f;
    border-radius: 14px;
    border: 1px solid #565869;
    overflow: visible;
    transition: border-color 0.2s;
}

.composer-attachments {
    display: none;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 0;
}

.composer-attachments.has-images {
    display: flex;
    padding: 10px 12px 0;
}

.composer-attachments[hidden] {
    display: none !important;
    padding: 0;
}

.composer-thumb {
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #565869;
    cursor: zoom-in;
    flex-shrink: 0;
}

.composer-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.composer-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.composer-thumb-remove:hover {
    background: #e53935;
}

.composer-thumb-status {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.composer-thumb-status::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: composer-spin 0.7s linear infinite;
}

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

.composer-thumb-add {
    width: 56px;
    height: 56px;
    border: 1px dashed #6b6c7b;
    border-radius: 8px;
    background: transparent;
    color: #acacbe;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.15s, color 0.15s;
}

.composer-thumb-add:hover {
    border-color: #8e8ea0;
    color: #ececf1;
}

.composer-thumb-add-icon {
    width: 22px;
    height: 22px;
    filter: invert(0.75);
    opacity: 0.9;
}

.composer-thumb-add:hover .composer-thumb-add-icon {
    filter: invert(0.92);
    opacity: 1;
}

.model-picker-name-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.model-picker-tags {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.model-picker-tag {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    border-radius: 6px;
    vertical-align: middle;
}

.model-picker-tag--vision {
    background: #19c37d33;
    color: #19c37d;
}

.model-picker-tag--tool_calling {
    background: #4dabf733;
    color: #74c0fc;
}

.model-picker-tag--thinking {
    background: #b197fc33;
    color: #c4b5fd;
}

.msg-images {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.msg-image-thumb {
    max-width: 200px;
    max-height: 160px;
    border-radius: 8px;
    object-fit: cover;
    cursor: zoom-in;
    border: 1px solid #565869;
}

.image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.image-lightbox.is-open {
    display: flex;
}

.image-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
}

.image-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 1200px);
    max-height: 90vh;
}

.image-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.image-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #40414f;
    color: #ececf1;
    font-size: 20px;
    cursor: pointer;
    z-index: 2;
}

.image-lightbox-close:hover {
    background: #e53935;
}

.composer:focus-within {
    border-color: #8e8ea0;
}

#messageInput {
    width: 100%;
    min-height: 80px;
    max-height: 220px;
    padding: 16px 18px 10px;
    background: transparent;
    border: none;
    color: #ececf1;
    font-size: 15px;
    outline: none;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
}

#messageInput::placeholder {
    color: #8e8ea0;
}

.composer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 10px 7px;
    border-top: 1px solid #4d4e57;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.toolbar-icon-btn,
.model-select-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #acacbe;
    cursor: pointer;
    transition: all 0.15s;
}

.toolbar-icon-btn:hover,
.model-select-btn:hover {
    background: #343541;
    border-color: #565869;
    color: #ececf1;
}

.toolbar-icon-btn img {
    display: block;
    filter: invert(0.8);
    opacity: 0.9;
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background: #565869;
    flex-shrink: 0;
}

.model-picker-wrap {
    position: relative;
}

.model-select-btn {
    max-width: 220px;
}

.model-select-label {
    font-size: 13px;
    color: #ececf1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-picker {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    width: min(480px, calc(100vw - 48px));
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background: #2a2b32;
    border: 1px solid #565869;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    z-index: 200;
    padding: 10px;
}

.model-picker::-webkit-scrollbar {
    display: none;
}

.model-picker.show {
    display: block;
}

.model-picker-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 13px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s;
}

.model-picker-item:hover,
.model-picker-item.active {
    background: #40414f;
}

.model-picker-name {
    font-size: 15px;
    font-weight: 600;
    color: #ececf1;
}

.model-picker-desc {
    font-size: 13px;
    line-height: 1.55;
    color: #8e8ea0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.model-picker-empty {
    padding: 16px;
    text-align: center;
    color: #8e8ea0;
    font-size: 13px;
}

.shortcut-hint {
    font-size: 11px;
    color: #6e6e80;
    white-space: nowrap;
}

.send-btn-circle {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #19c37d;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.send-btn-circle:hover:not(:disabled) {
    background: #1aa575;
    transform: translateY(-1px);
}

.send-btn-circle:disabled {
    background: #565869;
    cursor: not-allowed;
    transform: none;
}

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

.typing-dot {
    width: 8px;
    height: 8px;
    background: #8e8ea0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 滚动条样式 */
.conversations-list::-webkit-scrollbar,
.chat-container::-webkit-scrollbar {
    width: 8px;
}

.conversations-list::-webkit-scrollbar-track,
.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb,
.chat-container::-webkit-scrollbar-thumb {
    background: #565869;
    border-radius: 4px;
}

.conversations-list::-webkit-scrollbar-thumb:hover,
.chat-container::-webkit-scrollbar-thumb:hover {
    background: #6e6e80;
}

/* 响应式 */
@media (max-width: 768px) {
    .main-area {
        --msg-aside-width: 48px;
        --msg-h-padding: 12px;
    }

    .chat-container {
        padding-top: 16px;
        padding-bottom: 16px;
    }

    .input-area {
        padding-bottom: 16px;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 100;
        transform: translateX(-100%);
    }

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

    .example-prompts {
        grid-template-columns: 1fr;
    }
}

/* 空状态 */
.empty-state {
    padding: 40px;
    text-align: center;
    color: #8e8ea0;
    font-size: 14px;
}

/* 错误提示 */
.error-message {
    padding: 12px 16px;
    background: #f93a37;
    color: white;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 14px;
}

/* Toast 提示框 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: #2a2b32;
    border: 1px solid #40414f;
    border-radius: 8px;
    padding: 12px 20px;
    min-width: 250px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease-out;
    color: #ececf1;
    font-size: 14px;
}

.toast.success {
    border-left: 4px solid #19c37d;
}

.toast.error {
    border-left: 4px solid #f85149;
}

.toast.info {
    border-left: 4px solid #58a6ff;
}

.toast.warning {
    border-left: 4px solid #f0ad4e;
}

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: #19c37d;
}

.toast.error .toast-icon {
    color: #f85149;
}

.toast.info .toast-icon {
    color: #58a6ff;
}

.toast.warning .toast-icon {
    color: #f0ad4e;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 13px;
    color: #acacbe;
}

.toast.hiding {
    animation: slideOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
