:root { color-scheme: light dark; --bg-main: #f5f6f8; --bg-sidebar: #ffffff; --bg-panel: #ffffff; --border-color: #d8dce4; --primary: #1f77ff; --primary-text: #ffffff; --accent: #0d6efd; --text-color: #1a1a1a; --secondary-text: #6c757d; --user-message: #e9f2ff; --assistant-message: #f1f3f5; --shadow: 0 2px 12px rgba(15, 23, 42, 0.08); } * { box-sizing: border-box; } body { margin: 0; font-family: "PingFang SC", "Microsoft YaHei", "Helvetica", "Arial", sans-serif; background: var(--bg-main); color: var(--text-color); height: 100vh; display: flex; } .app-shell { display: flex; flex: 1; max-height: 100vh; width: 100%; } .sidebar { width: 320px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; overflow: hidden; } .sidebar-scroll { flex: 1; padding: 10px 16px 2px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; } .sidebar-history { border-top: 1px solid var(--border-color); padding: 3px ; background: #fff; display: flex; flex-direction: column; gap: 10px; overflow: auto; /* 允许滚动 */ scrollbar-width: none; /* Firefox */ } .sidebar-history::-webkit-scrollbar { display: none; /* Chrome 和 Safari */ } .sidebar-history-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; } .history-count { font-size: 12px; color: var(--secondary-text); } .sidebar-section { margin: 0; display: flex; flex-direction: column; gap: 6px; } .sidebar-actions { flex-direction: row; align-items: center; } .sidebar-actions .primary-button, .sidebar-actions .secondary-button { flex: 1; } .sidebar-label { font-size: 14px; font-weight: 600; color: var(--secondary-text); } .sidebar-input, .sidebar-range { width: 100%; padding: 8px 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 14px; background: #fff; color: inherit; } .sidebar-range { height: 4px; padding: 0; } .sidebar-help { font-size: 13px; color: var(--secondary-text); } .sidebar-heading { margin: 0; font-size: 16px; font-weight: 600; } .primary-button, .secondary-button { border: none; border-radius: 8px; padding: 10px 14px; font-size: 14px; cursor: pointer; transition: all 0.2s ease; } .primary-button { background: var(--primary); color: var(--primary-text); } .primary-button:disabled { opacity: 0.6; cursor: not-allowed; } .primary-button:hover:not(:disabled) { background: var(--accent); } .secondary-button { background: #f1f3f5; color: var(--text-color); border: 1px solid var(--border-color); } .secondary-button:hover:not(:disabled) { background: #e6e9ef; } .history-list { display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; } .history-row { display: grid; grid-template-columns: 1fr auto auto; gap: 4px; align-items: center; padding: 4px 10px; border: 1px solid var(--border-color); border-radius: 8px; background: #fff; } .history-row.active { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(13, 110, 253, 0.12); } .history-title-link { border: none; background: none; padding: 0; margin: 0; font-size: 14px; font-weight: 500; text-align: left; color: var(--accent); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-decoration: none; } .history-title-link:hover, .history-title-link:focus-visible { text-decoration: underline; } .history-row.active .history-title-link { color: var(--text-color); font-weight: 600; } .history-title-text, .history-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } .history-subtitle { font-size: 11px; color: var(--secondary-text); } .history-icon-button { border: none; background: #f8f9fb; border-radius: 6px; padding: 6px 8px; cursor: pointer; font-size: 16px; line-height: 1; } .history-icon-button:hover { background: #e6e9ef; } .history-pagination { display: flex; justify-content: space-between; gap: 2px; margin-bottom: 5px; margin-left: 10px; margin-right: 10px; } .history-pagination .secondary-button { padding: 3px 3px; font-size: 11px; border-radius: 6px; } .main-panel { flex: 1; display: flex; flex-direction: column; background: var(--bg-panel); box-shadow: var(--shadow); } .app-header { padding: 20px 24px; border-bottom: 1px solid var(--border-color); } .app-header h1 { margin: 0; font-size: 22px; font-weight: 600; } .chat-messages { flex: 1; padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; background: linear-gradient(180deg, rgba(243, 247, 255, 0.8), rgba(255, 255, 255, 0.9)); } .message { padding: 16px; border-radius: 12px; border: 1px solid var(--border-color); max-width: 860px; display: flex; flex-direction: column; gap: 10px; } .message.user { background: var(--user-message); align-self: flex-end; } .message.assistant { background: var(--assistant-message); align-self: flex-start; } .message-header { font-size: 13px; font-weight: 600; color: var(--secondary-text); } .message-content { font-size: 14px; line-height: 1.6; color: var(--text-color); white-space: normal; word-break: break-word; } .message-content ul { margin: 8px 0 8px 18px; padding-left: 16px; } .message-content li { margin-bottom: 4px; } .message-content blockquote { margin: 10px 0; padding-left: 14px; border-left: 3px solid var(--border-color); color: var(--secondary-text); } .message-content h1, .message-content h2, .message-content h3, .message-content h4, .message-content h5, .message-content h6 { margin: 12px 0 6px; font-weight: 600; } .message-content h1 { font-size: 20px; } .message-content h2 { font-size: 18px; } .message-content h3 { font-size: 16px; } .message-content h4 { font-size: 15px; } .message-content h5, .message-content h6 { font-size: 14px; } .message-content pre { background: #0d1117; color: #e6edf3; padding: 12px; border-radius: 10px; overflow-x: auto; font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace; font-size: 13px; line-height: 1.5; margin: 10px 0; } .message-content code { font-family: "JetBrains Mono", "Fira Code", "Menlo", "Consolas", monospace; background: rgba(13, 110, 253, 0.12); color: #0d47a1; padding: 2px 6px; border-radius: 6px; font-size: 13px; } .message-content pre code { display: block; background: transparent; color: inherit; padding: 0; } .message-content img { max-width: 100%; border-radius: 8px; margin: 6px 0; } .message-actions { display: flex; justify-content: flex-end; gap: 6px; } .message-button { border: none; background: var(--primary); color: var(--primary-text); border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background 0.2s ease; } .message-button:hover { background: var(--accent); } .chat-form { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 10px; background: #fff; } .chat-textarea { width: 100%; border-radius: 12px; border: 1px solid var(--border-color); padding: 10px; font-size: 14px; resize: vertical; min-height: 70px; } .chat-form-footer { display: flex; align-items: center; gap: 10px; } .file-input-label { display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 8px; border: 1px dashed var(--border-color); color: var(--secondary-text); cursor: pointer; background: #fafbfc; } .file-input { display: none; } .chat-status { min-height: 20px; font-size: 13px; color: var(--secondary-text); display: flex; align-items: center; gap: 8px; } .chat-status.running { color: var(--accent); } .chat-status.running::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: chat-spin 0.8s linear infinite; } .chat-status.error { color: #dc3545; } .toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: rgba(33, 37, 41, 0.9); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); opacity: 0; transition: opacity 0.3s ease, transform 0.3s ease; pointer-events: none; z-index: 999; } .toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.success { background: #28a745; } .toast.error { background: #dc3545; } .hidden { display: none; } .clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; } mark.hl { background: #fff3a3; color: inherit; padding: 0 2px; border-radius: 3px; } @keyframes chat-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } @media (max-width: 960px) { .app-shell { flex-direction: column; } .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); } .sidebar-scroll { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; } .main-panel { box-shadow: none; } .history-list { max-height: 180px; } .sidebar-actions { flex-direction: column; } } @media (max-width: 600px) { .chat-form-footer { flex-direction: column; align-items: stretch; } .chat-form-footer .primary-button { width: 100%; } .file-input-label { width: 100%; justify-content: center; } }