/* static/style-enhanced.css - 增强版，包含对话历史管理功能 */

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

:root {
    --app-viewport: 100vh;
    --app-bottom-inset: env(safe-area-inset-bottom, 0px);
    --claude-bg: #eeece2;
    --claude-panel: rgba(255, 255, 255, 0.82);
    --claude-sidebar: rgba(255, 255, 255, 0.68);
    --claude-border: rgba(118, 103, 84, 0.25);
    --claude-text: #3d3929;
    --claude-text-secondary: #7f7766;
    --claude-muted: rgba(121, 109, 94, 0.4);
    --claude-accent: #da7756;
    --claude-accent-strong: #bd5d3a;
    --claude-highlight: rgba(218, 119, 86, 0.14);
    --claude-button-hover: #c76541;
    --claude-button-active: #a95331;
    --claude-shadow: 0 14px 36px rgba(61, 57, 41, 0.12);
    --claude-success: #76b086;
    --claude-warning: #d99845;
    --claude-danger: #d65a5a;
}

html, body {
    height: var(--app-viewport, 100vh);
}

body {
    font-family: 'Iowan Old Style', ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
    background: var(--claude-bg);
    color: var(--claude-text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* 顶部状态栏 */
.header {
    background: var(--claude-panel);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--claude-border);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    z-index: 100;
    box-shadow: 0 10px 24px rgba(61, 57, 41, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--claude-text);
    letter-spacing: 0.02em;
}

.agent-version {
    color: var(--claude-text-secondary);
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.thinking-mode {
    background: var(--claude-accent);
    color: #fff8f2;
    padding: 5px 14px;
    border-radius: 980px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
}

.terminate-btn {
    background: var(--claude-danger);
    color: #fff6f6;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.terminate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.connection-status {
    font-size: 13px;
    color: var(--claude-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--claude-muted);
    transition: all 0.3s ease;
}

.status-dot.active {
    background: var(--claude-success);
    box-shadow: 0 0 8px rgba(118, 176, 134, 0.45);
}

/* 主容器 */
.main-container {
    display: flex;
    height: calc(var(--app-viewport, 100vh) - 56px);
    background: var(--claude-bg);
    position: relative;
    align-items: stretch;
}

/* ========================================= */
/* 新增：对话历史侧边栏样式 */
/* ========================================= */

.conversation-sidebar {
    width: 280px;
    background: var(--claude-sidebar);
    border-right: none;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    backdrop-filter: blur(12px);
    height: calc(var(--app-viewport, 100vh) - 56px) !important;
    min-height: calc(var(--app-viewport, 100vh) - 56px) !important;
    border-bottom: 1px solid var(--claude-border);
}

.conversation-collapsed-spacer {
    flex: 1 1 auto;
    background: transparent;
}

.conversation-sidebar.collapsed {
    width: 50px;
    overflow: hidden;
    height: calc(var(--app-viewport, 100vh) - 56px) !important;
    min-height: calc(var(--app-viewport, 100vh) - 56px) !important;
}

.conversation-sidebar.collapsed .conversation-header {
    justify-content: center;
}

.conversation-sidebar.collapsed .conversation-header .toggle-sidebar-btn {
    margin-left: 0;
}

.conversation-header {
    padding: 18px 16px;
    border-bottom: 1px solid rgba(118, 103, 84, 0.12);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-text);
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 68px;
}

.new-conversation-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--claude-accent) 0%, var(--claude-accent-strong) 100%);
    color: #fff8f2;
    border: 1px solid rgba(189, 93, 58, 0.4);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 6px 14px rgba(189, 93, 58, 0.18);
}

.new-conversation-btn:hover {
    background: linear-gradient(135deg, var(--claude-button-hover) 0%, var(--claude-button-active) 100%);
    transform: translateY(-1px);
}

.btn-icon {
    font-size: 16px;
    font-weight: bold;
}

.btn-text {
    white-space: nowrap;
}

.toggle-sidebar-btn {
    background: rgba(255, 255, 255, 0.7);
    color: var(--claude-text);
    border: 1px solid rgba(118, 103, 84, 0.18);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

.conversation-search {
    padding: 12px;
    background: transparent;
    border-bottom: 1px solid var(--claude-border);
}

.search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--claude-border);
    border-radius: 6px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.55);
    color: var(--claude-text);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--claude-accent);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 0 3px rgba(218, 119, 86, 0.18);
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    background: transparent;
}

.loading-conversations,
.no-conversations {
    text-align: center;
    color: var(--claude-text-secondary);
    padding: 30px 15px;
    font-size: 13px;
}

.conversation-item {
    padding: 12px 16px;
    margin: 2px 8px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 6px 16px rgba(61, 57, 41, 0.04);
}

.conversation-item:hover {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(218, 119, 86, 0.35);
    box-shadow: 0 10px 24px rgba(61, 57, 41, 0.08);
}

.conversation-item.active {
    background: rgba(218, 119, 86, 0.18);
    border-color: var(--claude-accent);
    box-shadow: 0 10px 28px rgba(189, 93, 58, 0.18);
}

.conversation-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--claude-text);
    margin-bottom: 6px;
    word-wrap: break-word;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.3;
}

.conversation-meta {
    font-size: 11px;
    color: var(--claude-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.conversation-time {
    flex-shrink: 0;
}

.conversation-counts {
    text-align: right;
    white-space: nowrap;
    font-size: 10px;
}

.conversation-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.conversation-item:hover .conversation-actions {
    opacity: 1;
}

.conversation-action-btn {
    border: none;
    border-radius: 4px;
    font-size: 13px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    color: white;
}

.conversation-action-btn.copy-btn {
    background: var(--claude-accent);
}

.conversation-action-btn.copy-btn:hover {
    background: var(--claude-button-hover);
    transform: translateY(-1px);
}

.conversation-action-btn.delete-btn {
    background: #d85a42;
}

.conversation-action-btn.delete-btn:hover {
    background: #bf422b;
    transform: translateY(-1px);
}

.load-more {
    padding: 12px 16px;
    text-align: center;
}

.load-more-btn {
    background: rgba(218, 119, 86, 0.12);
    color: var(--claude-accent);
    border: 1px solid rgba(218, 119, 86, 0.35);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.load-more-btn:hover:not(:disabled) {
    background: var(--claude-accent);
    color: #fffdf8;
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 当前对话信息栏 */
.current-conversation-info {
    background: var(--claude-panel);
    backdrop-filter: blur(18px);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: var(--claude-text-secondary);
    box-shadow: 0 12px 28px rgba(61, 57, 41, 0.06);
}

.conversation-title-display {
    font-weight: 500;
    color: var(--claude-text);
}

.conversation-message-count {
    font-size: 12px;
}

/* 拖拽手柄 */
.resize-handle {
    width: 4px;
    background: var(--claude-sidebar);
    cursor: col-resize;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.resize-handle:hover {
    background: rgba(218, 119, 86, 0.22);
}

/* 侧边栏 */
.sidebar {
    background: rgba(255, 255, 255, 0.75);
    overflow-y: auto;
    flex-shrink: 0;
    border-left: none;
}

.sidebar-header {
    padding: 23px;
    border-bottom: 1px solid var(--claude-border);
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.85);
    z-index: 10;
    backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--claude-text);
    margin: 0;
}

.sidebar-manage-btn {
    border: 1px solid rgba(118, 103, 84, 0.25);
    background: rgba(255, 255, 255, 0.75);
    color: var(--claude-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.sidebar-manage-btn:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(118, 103, 84, 0.45);
}

.sidebar-view-toggle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(118, 103, 84, 0.3);
    background: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    color: var(--claude-text);
}

.sidebar-view-toggle:hover {
    background: rgba(255, 255, 255, 0.95);
}

.sidebar.right-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    border-left: none;
    overflow: hidden;
}

.sidebar.right-sidebar.collapsed .sidebar-header,
.sidebar.right-sidebar.collapsed .focused-files {
    display: none;
}

/* 文件树 */
.file-tree {
    padding: 12px 0 20px;
    color: var(--claude-text);
}

.todo-panel {
    padding: 16px 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sub-agent-panel {
    padding: 16px 16px 24px;
}

.sub-agent-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sub-agent-card {
    border: 1px solid rgba(118, 103, 84, 0.2);
    border-radius: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.92);
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.sub-agent-card:hover {
    border-color: #6c5ce7;
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.15);
}

.sub-agent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 6px;
}

.sub-agent-status {
    text-transform: capitalize;
    font-size: 12px;
}

.sub-agent-status.running {
    color: #0984e3;
}

.sub-agent-status.completed {
    color: #00b894;
}

.sub-agent-status.failed,
.sub-agent-status.timeout {
    color: #d63031;
}

.sub-agent-summary {
    font-size: 13px;
    color: var(--claude-text);
    margin-bottom: 4px;
}

.sub-agent-tool {
    font-size: 12px;
    color: var(--claude-text-secondary);
}

.todo-empty {
    font-size: 14px;
    color: var(--claude-text-secondary);
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px dashed var(--claude-border);
    text-align: center;
}

.todo-task {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid rgba(118, 103, 84, 0.18);
    border-radius: 10px;
    font-size: 13px;
    color: var(--claude-text);
    background: rgba(255, 255, 255, 0.9);
}

.todo-task.done {
    background: rgba(92, 190, 125, 0.08);
    border-color: rgba(92, 190, 125, 0.3);
}

.todo-task-title {
    flex: 1;
}

.todo-task-status {
    font-weight: 600;
    font-size: 12px;
    margin-left: 12px;
}

.todo-instruction {
    font-size: 12px;
    color: var(--claude-text-secondary);
    margin-top: 8px;
}

.file-node-wrapper {
    font-size: 14px;
    color: var(--claude-text);
    font-family: inherit;
}

.folder-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease, transform 0.2s ease;
    text-align: left;
    font-family: inherit;
}

.folder-header:hover {
    background: rgba(218, 119, 86, 0.12);
    transform: translateX(2px);
}

.folder-arrow {
    width: 12px;
    text-align: center;
    color: var(--claude-text-secondary);
    font-size: 12px;
}

.folder-icon,
.file-icon {
    width: 18px;
    text-align: center;
}

.folder-name,
.file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}


.folder-children {
    margin-left: 14px;
    padding-left: 6px;
    border-left: 1px dashed rgba(0, 0, 0, 0.08);
}

.folder-children .file-node-wrapper {
    margin-left: 0;
}

.file-node.file-leaf {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: inherit;
}

.file-node.file-leaf:hover {
    background: rgba(218, 119, 86, 0.1);
}

.file-node .annotation {
    color: var(--claude-text-secondary);
    font-size: 12px;
    margin-left: 8px;
}

.context-menu {
    position: fixed;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.15);
    z-index: 3000;
    min-width: 180px;
    padding: 6px 0;
    backdrop-filter: blur(8px);
}

.context-menu button {
    width: 100%;
    padding: 8px 18px;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 13px;
    color: #1f2933;
    cursor: pointer;
    transition: background 0.15s ease;
}

.context-menu button:hover {
    background: rgba(59, 130, 246, 0.12);
}

.context-menu button:disabled {
    color: #9ca3af;
    cursor: not-allowed;
    background: transparent;
}

/* 聊天容器 */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.78);
    min-width: 0;
    min-height: 0;
    position: relative;
    backdrop-filter: blur(6px);
}

/* 消息区域 */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    padding-bottom: calc(24px + var(--app-bottom-inset, 0px));
    min-height: 0;
}

.scroll-lock-toggle {
    position: absolute;
    right: 28px;
    bottom: 200px;
    z-index: 25;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.scroll-lock-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--claude-border);
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 16px rgba(61, 57, 41, 0.08);
}

.scroll-lock-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 9px 20px rgba(61, 57, 41, 0.12);
}

.scroll-lock-toggle.locked .scroll-lock-btn {
    border-color: rgba(218, 119, 86, 0.32);
    box-shadow: 0 0 10px rgba(218, 119, 86, 0.28);
}

.scroll-lock-btn svg {
    width: 18px;
    height: 18px;
    stroke: var(--claude-text);
    stroke-width: 1.8;
    fill: none;
    transition: stroke 0.2s ease;
}

.scroll-lock-toggle.locked .scroll-lock-btn svg {
    stroke: var(--claude-accent);
}

/* 滚动条 */
.messages-area::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.conversation-list::-webkit-scrollbar {
    width: 8px;
}

.messages-area::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.conversation-list::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.conversation-list::-webkit-scrollbar-thumb {
    background: rgba(121, 109, 94, 0.4);
    border-radius: 8px;
}

/* 消息块 */
.message-block {
    margin-bottom: 24px;
}

/* 用户消息 */
.user-message .message-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--claude-text);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.user-message .message-text {
    background: rgba(255, 255, 255, 0.85);
    padding: 16px 20px;
    border-radius: 18px;
    color: var(--claude-text);
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 12px 28px rgba(61, 57, 41, 0.08);
    white-space: pre-wrap;
}

/* AI消息 */
.assistant-message .message-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--claude-text);
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.assistant-message .message-text {
    background: rgba(218, 119, 86, 0.12);
    padding: 16px 20px;
    border-radius: 18px;
    color: var(--claude-text);
    font-size: 15px;
    line-height: 1.6;
    box-shadow: 0 12px 28px rgba(61, 57, 41, 0.08);
    border-left: 4px solid var(--claude-accent);
    white-space: pre-wrap;
}

/* Action项入场动画 */
@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.action-item {
    animation: slideInFade 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0ms;
}

/* 流式内容：立即显示 */
.action-item.streaming-content,
.action-item.immediate-show {
    animation: quickFadeIn 0.2s ease-out both;
    animation-delay: 0ms !important;
}

/* 已完成的工具：统一延迟看动画 */
.action-item.completed-tool {
    animation: slideInFade 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 100ms;
}

/* 文本输出 - 无缩进，与思考块对齐 */
.text-output {
    margin: 16px 0;
    color: var(--claude-text);
    font-size: 15px;
    line-height: 1.7;
}

.text-output .text-content {
    padding: 0 20px 0 15px;  /* 左边56px与思考块对齐 */
}

.text-output .text-content p {
    margin-bottom: 12px;
}

.text-output .text-content p:last-child {
    margin-bottom: 0;
}

.system-action {
    margin: 12px 0;
    padding: 10px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(59, 130, 246, 0.08));
    border-left: 4px solid rgba(79, 70, 229, 0.6);
    color: var(--claude-text);
    font-size: 14px;
    line-height: 1.5;
}

.system-action-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.append-block {
    margin: 12px 0;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.82);
    border-left: 4px solid rgba(218, 119, 86, 0.32);
    box-shadow: inset 0 0 0 1px rgba(218, 119, 86, 0.05);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.append-block.append-error {
    background: rgba(255, 244, 242, 0.85);
    border-left-color: rgba(216, 90, 66, 0.38);
    box-shadow: inset 0 0 0 1px rgba(216, 90, 66, 0.08);
}

.append-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--claude-text);
    font-size: 15px;
}

.append-block.append-error .append-header {
    color: #b0432a;
}

.append-icon {
    font-size: 18px;
}

.append-summary {
    flex: 1;
}

.append-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--claude-text-secondary);
    font-size: 13px;
}

.append-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.append-warning {
    color: var(--claude-warning);
    font-weight: 500;
}

.modify-placeholder {
    margin: 12px 0;
}

.modify-placeholder-content {
    background: rgba(255, 255, 255, 0.82);
    border-left: 4px solid rgba(218, 119, 86, 0.32);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--claude-text);
    font-size: 14px;
    line-height: 1.6;
}

.modify-placeholder-content .modify-warning {
    color: var(--claude-warning);
    font-weight: 500;
}

.modify-placeholder-content .modify-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--claude-text-secondary);
    font-size: 13px;
}

.append-placeholder {
    margin: 12px 0;
}


.append-placeholder-content {
    background: rgba(255, 255, 255, 0.82);
    border-left: 4px solid rgba(218, 119, 86, 0.32);
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--claude-text);
    font-size: 14px;
    line-height: 1.6;
}

.append-placeholder-content .append-warning {
    margin-top: 4px;
}

.append-placeholder.append-error .append-placeholder-content {
    background: rgba(255, 244, 242, 0.85);
    border-left-color: rgba(216, 90, 66, 0.38);
}
/* Markdown表格样式 */
.text-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.text-content table th,
.text-content table td {
    border: 1px solid #e0e0e0;
    padding: 10px 14px;
    text-align: left;
}

.text-content table th {
    background: rgba(218, 119, 86, 0.08);
    font-weight: 600;
    color: var(--claude-text);
}

.text-content table tr:hover {
    background: #fafafa;
}

/* 代码块包装器 - 防止跳动 */
.code-block-wrapper {
    border: 2px solid rgba(118, 103, 84, 0.25);
    border-radius: 12px;
    overflow: hidden;
    margin: 16px 0;
    background: rgba(255, 255, 255, 0.78);
    min-height: 80px;  /* 添加最小高度防止跳动 */
    contain: layout;    /* CSS containment 优化渲染 */
}

/* 代码块头部 */
.code-block-header {
    background: rgba(218, 119, 86, 0.08);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(118, 103, 84, 0.25);
}

.code-language {
    color: var(--claude-text-secondary);
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-weight: 500;
}

.copy-code-btn {
    background: transparent;
    color: var(--claude-text-secondary);
    border: 1px solid rgba(121, 109, 94, 0.35);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.copy-code-btn:hover {
    background: rgba(218, 119, 86, 0.12);
    color: var(--claude-accent-strong);
}

.copy-code-btn.copied {
    background: var(--claude-success);
    border-color: var(--claude-success);
    color: #f6fff8;
}

/* 代码块内容区 */
.code-block-wrapper pre {
    background: #ffffff !important;
    padding: 16px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    border: none !important;
}

.code-block-wrapper pre code {
    background: transparent !important;
    padding: 0 !important;
    color: #000000;
}
/* 流式文本 */
.streaming-text {
    display: block;
}

.cursor-blink {
    animation: blink 1s steps(1) infinite;
    color: var(--claude-accent);
    font-weight: normal;
}

/* 思考内容样式 - 保留换行 */
.thinking-content {
    white-space: pre-wrap;  /* 保留换行和空格 */
    word-wrap: break-word;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: var(--claude-text-secondary);
}

/* 可折叠块 */
.collapsible-block {
    background: rgba(255, 255, 255, 0.78);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--claude-border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 12px 28px rgba(61, 57, 41, 0.08);
}

.collapsible-block:hover {
    box-shadow: 0 14px 28px rgba(61, 57, 41, 0.1);
}

.collapsible-header {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    user-select: none;
    background: rgba(255, 255, 255, 0.72);
    transition: background-color 0.2s ease;
    position: relative;
}

.collapsible-header:hover {
    background: rgba(218, 119, 86, 0.07);
}

/* 箭头 */
.arrow {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--claude-text-secondary);
}

.arrow::before {
    content: '›';
    font-size: 18px;
}

.collapsible-block.expanded .arrow {
    transform: rotate(90deg);
}

/* 状态图标 */
.status-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* 内容区域 */
.collapsible-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsible-block.expanded .collapsible-content {
    max-height: 600px;
    overflow-y: auto;
    opacity: 1;
}

.content-inner {
    padding: 20px 20px 20px 56px;
    color: var(--claude-text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* 工具动画 */
@keyframes brain-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.thinking-icon {
    animation: brain-pulse 1.5s ease-in-out infinite;
}

@keyframes file-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.file-animation {
    animation: file-bounce 1.5s ease-in-out infinite;
}

@keyframes scan-effect {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.read-animation {
    animation: scan-effect 1.5s ease-in-out infinite;
}

@keyframes search-rotate {
    0% { transform: rotate(-10deg); }
    50% { transform: rotate(10deg); }
    100% { transform: rotate(-10deg); }
}

.search-animation {
    animation: search-rotate 1s ease-in-out infinite;
}

@keyframes code-breathe {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.code-animation {
    animation: code-breathe 2s ease-in-out infinite;
}

.terminal-animation::after {
    content: '_';
    animation: blink 1s steps(1) infinite;
    margin-left: 2px;
}

@keyframes memory-fade {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.95); }
}

.memory-animation {
    animation: memory-fade 2s ease-in-out infinite;
}

@keyframes focus-glow {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.3); }
}

.focus-animation {
    animation: focus-glow 1.5s ease-in-out infinite;
}

/* 进度条 */
.progress-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--claude-accent);
    animation: progress 2s ease-in-out infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.collapsible-block.processing .progress-indicator {
    opacity: 1;
}

@keyframes progress {
    0% { width: 0%; left: 0%; }
    50% { width: 40%; left: 30%; }
    100% { width: 0%; left: 100%; }
}

/* 状态文字 */
.status-text {
    font-size: 14px;
    color: var(--claude-text);
    font-weight: 500;
}

.processing .status-text {
    color: var(--claude-text-secondary);
}

/* 完成勾号 */
.checkmark {
    color: var(--claude-success);
    font-weight: 600;
    font-size: 16px;
}

/* 工具描述 */
.tool-desc {
    color: var(--claude-text-secondary);
    font-size: 12px;
    margin-left: 8px;
}

.input-area {
    background: rgba(255, 255, 255, 0.82);
    border-top: 1px solid var(--claude-border);
    padding: 20px;
    padding-bottom: calc(20px + var(--app-bottom-inset, 0px));
    backdrop-filter: blur(12px);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--claude-border);
    border-radius: 12px;
    font-size: 15px;
    resize: none;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.75);
    color: var(--claude-text);
    transition: all 0.2s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--claude-accent);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 3px rgba(218, 119, 86, 0.2);
}

.input-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* 按钮 */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: 980px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.03em;
}

.send-btn {
    background: var(--claude-accent);
    color: #fffdf8;
    box-shadow: 0 12px 28px rgba(189, 93, 58, 0.25);
}

.send-btn:hover:not(:disabled) {
    background: var(--claude-button-hover);
    transform: scale(1.02);
    box-shadow: 0 14px 32px rgba(189, 93, 58, 0.3);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.stop-btn {
    background: #d85a42;
    color: #fffaf5;
}

.stop-btn:hover {
    background: #bf422b;
}

.settings-dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.tool-dropdown {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: auto;
}

.upload-control {
    display: flex;
    align-items: center;
}

.file-input-hidden {
    display: none;
}

.upload-btn {
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-text);
    border: 1px solid rgba(118, 103, 84, 0.2);
}

.upload-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.95);
}

.upload-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-text);
    border: 1px solid rgba(118, 103, 84, 0.2);
}

.tool-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.95);
}

.tool-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.settings-btn {
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-text);
    border: 1px solid rgba(118, 103, 84, 0.2);
}

.settings-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.95);
}

.settings-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* 适应折叠屏/矮屏幕，保证输入区完整可见 */
@media (max-height: 900px) {
    .messages-area {
        padding: 16px 18px;
    }
    .input-area {
        padding: 14px;
    }
    .message-input {
        padding: 12px 14px;
        min-height: 120px;
    }
    .btn {
        padding: 8px 18px;
    }
}

.settings-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 12px);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--claude-border);
    border-radius: 12px;
    box-shadow: var(--claude-shadow);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 150px;
    z-index: 40;
}

.settings-menu::before {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 20px;
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.96) transparent transparent transparent;
    filter: drop-shadow(0 3px 4px rgba(61, 57, 41, 0.12));
}

.settings-menu.tool-menu {
    right: auto;
    left: 0;
    min-width: 520px;
    max-width: 580px;
    padding: 16px 20px;
}

.settings-menu.tool-menu::before {
    left: 32px;
    right: auto;
}

.tool-menu .tool-menu-status,
.tool-menu .tool-menu-empty {
    font-size: 13px;
    color: rgba(61, 57, 41, 0.78);
    text-align: left;
}

.tool-menu .tool-menu-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 12px;
}

.tool-menu .tool-category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 10px;
    border: 1px solid rgba(118, 103, 84, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    aspect-ratio: 1 / 1;
    min-height: 0;
    justify-content: space-between;
}

.tool-menu .tool-category-item.disabled {
    opacity: 0.55;
}

.tool-menu .tool-category-label {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--claude-text);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    white-space: nowrap;
    line-height: 1.4;
}

.tool-category-icon {
    font-size: 20px;
}

.tool-menu .tool-category-toggle {
    width: 100% !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    text-align: center;
    white-space: nowrap;
    margin-top: auto;
}

.menu-btn {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid rgba(118, 103, 84, 0.14);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-btn:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
}

.menu-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.menu-btn.compress-entry {
    background: rgba(255, 255, 255, 0.78);
    color: var(--claude-success);
}

.menu-btn.compress-entry:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.95);
}

.menu-btn.clear-entry {
    background: rgba(255, 255, 255, 0.78);
    color: #bf422b;
}

.menu-btn.clear-entry:not(:disabled):hover {
    background: rgba(255, 255, 255, 0.95);
}

.settings-menu-enter-active,
.settings-menu-leave-active {
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.settings-menu-enter-from,
.settings-menu-leave-to {
    opacity: 0;
    transform: translateY(6px);
}

/* 聚焦文件 */
.focused-files {
    padding: 16px;
}

.no-files {
    text-align: center;
    color: var(--claude-text-secondary);
    padding: 60px 20px;
    font-size: 14px;
}

.file-tabs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-tab {
    border: 1px solid var(--claude-border);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 12px 28px rgba(61, 57, 41, 0.08);
}

.tab-header {
    background: rgba(218, 119, 86, 0.08);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    border-bottom: 1px solid var(--claude-border);
}

.file-name {
    font-weight: 500;
    color: var(--claude-text);
}

.file-size {
    color: var(--claude-text-secondary);
    font-size: 12px;
}

.file-content {
    max-height: 320px;
    overflow-y: auto;
    background: #1e1e1e;
}

.file-content pre {
    margin: 0;
    padding: 16px;
}

.file-content code {
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    color: #aed581;
}

/* 系统消息 */
.system-message {
    text-align: center;
    color: var(--claude-text-secondary);
    font-size: 13px;
    margin: 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 1px solid var(--claude-border);
}

/* Markdown样式 */
.text-content h1, 
.text-content h2, 
.text-content h3 {
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--claude-text);
}

.text-content p {
    margin-bottom: 12px;
}

.text-content pre {
    background: rgba(255, 255, 255, 0.78);
    padding: 16px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 16px 0;
    border: 1px solid var(--claude-border);
    box-shadow: 0 10px 24px rgba(61, 57, 41, 0.08);
}

.text-content code {
    background: rgba(218, 119, 86, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: var(--claude-accent-strong);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}


/* ========================================= */
/* 响应式设计 */
/* ========================================= */

@media (max-width: 1200px) {
    .conversation-sidebar {
        width: 260px;
    }
    
    .left-sidebar,
    .right-sidebar {
        width: 300px !important;
    }
}

@media (max-width: 768px) {
    .conversation-sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1000;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transform: translateX(-100%);
    }
    
    .conversation-sidebar:not(.collapsed) {
        transform: translateX(0);
    }
    
    .left-sidebar,
    .right-sidebar {
        display: none;
    }
    
    .resize-handle {
        display: none;
    }
}
.conversation-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--claude-text-secondary);
}


/* Markdown列表样式 - 修复偏左问题 */
.text-content ul,
.text-content ol {
    margin-left: 24px;  /* 增加左边距 */
    padding-left: 0;
    margin-bottom: 12px;
}

.text-content ul {
    list-style-type: disc;  /* 实心圆点 */
}

.text-content ul ul {
    list-style-type: circle;  /* 空心圆点 */
    margin-top: 6px;
}

.text-content ol {
    list-style-type: decimal;  /* 数字列表 */
}

.text-content li {
    margin-bottom: 6px;
    line-height: 1.6;
}

/* 搜索结果展示 */
.search-meta {
    font-size: 14px;
    color: var(--claude-text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    word-break: break-word;
}

.search-result-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-result-item {
    padding: 10px 12px;
    border: 1px solid rgba(118, 103, 84, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.65);
    word-break: break-word;
}

.search-result-title {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--claude-text);
}

.search-result-url a {
    color: var(--claude-accent-strong);
    text-decoration: none;
    word-break: break-all;
}

.search-result-url a:hover {
    text-decoration: underline;
}

.search-empty {
    font-size: 13px;
    color: var(--claude-text-secondary);
    font-style: italic;
}
