/* ── Chat Container ── */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.messages::-webkit-scrollbar { width: 4px; }
.messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Messages ── */
.msg { max-width: 85%; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.5; animation: fadeIn .2s ease; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 3px; }
.msg.assistant { align-self: flex-start; background: var(--bg-card); border-bottom-left-radius: 3px; }
.msg.msg-error { color: var(--red); }
.msg .msg-agent { font-size: 10px; font-weight: 600; margin-bottom: 3px; }
.msg .msg-time { font-size: 9px; color: var(--text-muted); margin-top: 3px; text-align: right; }

/* ── Streaming ── */
.msg.assistant .stream-text p { margin: 0 0 6px; }
.msg.assistant .stream-text p:last-child { margin: 0; }
.msg.assistant .stream-text pre { background: rgba(0,0,0,.3); padding: 6px 8px; border-radius: 4px; overflow-x: auto; font-size: 11px; margin: 4px 0; }
.msg.assistant .stream-text code { background: rgba(0,0,0,.2); padding: 1px 4px; border-radius: 3px; font-size: 11px; }
.msg.assistant .stream-text pre code { background: none; padding: 0; }
.msg.assistant .stream-text ul, .msg.assistant .stream-text ol { margin: 4px 0; padding-left: 18px; }

/* ── Typing Indicator ── */
.typing-dots { display: inline-flex; gap: 3px; padding: 4px 0; }
.typing-dots span { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); animation: typingBounce .6s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

/* ── Input ── */
.input-area { padding: 8px 12px; border-top: 1px solid var(--border); display: flex; gap: 6px; }
.input-area textarea { flex: 1; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); padding: 8px 10px; font-family: var(--font); font-size: 12px; resize: none; outline: none; min-height: 36px; max-height: 100px; }
.input-area textarea:focus { border-color: var(--accent); }
.input-area .send-btn { background: var(--accent); border: none; color: #fff; border-radius: var(--radius); padding: 0 14px; cursor: pointer; font-size: 12px; font-weight: 500; }
.input-area .send-btn:hover { opacity: .85; }

/* ── Tool Blocks ── */
.tool-block { background: var(--glass); border: 1px solid var(--glass-b); border-radius: 10px; padding: 12px 16px; margin: 8px 0; }
.tool-header { display: flex; align-items: center; gap: 8px; }
.tool-status { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.tool-status.running { background: var(--text); animation: pulse 1.5s infinite; }
.tool-status.error { background: var(--red); }
.tool-name { font-family: 'SF Mono', monospace; font-size: 11px; color: var(--text-dim); }
.tool-input { font-family: 'SF Mono', monospace; font-size: 10px; background: rgba(0,0,0,0.3); padding: 10px; border-radius: 6px; margin-top: 10px; overflow-x: auto; white-space: pre-wrap; color: var(--text-muted); }

/* ── Markdown ── */
.markdown-content { padding: 4px 8px; }
.markdown-content h1,.markdown-content h2,.markdown-content h3 { margin: 20px 0 10px; font-weight: 600; }
.markdown-content h1 { font-size: 18px; }
.markdown-content h2 { font-size: 16px; }
.markdown-content h3 { font-size: 14px; }
.markdown-content code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 4px; font-family: 'SF Mono', monospace; font-size: 12px; }
.markdown-content pre { background: rgba(0,0,0,0.4); padding: 14px; border-radius: 8px; overflow-x: auto; margin: 14px 0; }
.markdown-content pre code { background: none; padding: 0; }
.markdown-content a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
