body { margin:0; font-family:var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif); background:var(--background,#faf9f7); color:var(--foreground,#1c1917); }

.page-wrap { max-width:1400px; margin:0 auto; padding:16px 20px; }

/* Header */
.page-header { margin-bottom:12px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.page-header h1 { font-size:20px; font-weight:700; margin:0; }
.page-header p { font-size:12px; color:var(--muted-fg,#78716c); margin:2px 0 0; }
.header-badge { padding:3px 10px; font-size:11px; font-weight:600; border-radius:12px; background:#f0efec; color:#78716c; }
.tag-list { display:flex; flex-wrap:wrap; gap:4px; margin-top:6px; }
.tag-list .tag { display:inline-block; padding:2px 9px; font-size:10px; background:var(--muted,#f0efec); border-radius:10px; color:var(--muted-fg); }

/* ═══════ 2-Column Layout ═══════ */
.split-layout { display:grid; grid-template-columns:1fr 380px; gap:12px; height:calc(100vh - 130px); min-height:450px; }

/* Left: Chat */
.chat-panel { display:flex; flex-direction:column; background:var(--card,#fff); border:1px solid var(--border,#e7e5e2); border-radius:12px; overflow:hidden; }

.chat-messages { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:10px; }
.chat-messages::-webkit-scrollbar { width:3px; }
.chat-messages::-webkit-scrollbar-thumb { background:rgba(0,0,0,.08); border-radius:4px; }

.msg { max-width:88%; padding:9px 13px; border-radius:12px; font-size:13px; line-height:1.5; word-break:break-word; }
.msg.user { align-self:flex-end; background:var(--primary,#1c1917); color:#fff; border-bottom-right-radius:4px; }
.msg.user .user-img { max-width:150px; border-radius:6px; margin-bottom:6px; display:block; }
.msg.ai { align-self:flex-start; background:var(--muted,#f0efec); color:var(--foreground); border-bottom-left-radius:4px; }
.msg.ai .meta { margin-top:5px; font-size:10px; color:var(--muted-fg,#78716c); display:flex; gap:6px; }
.msg.system { align-self:center; font-size:11px; color:var(--muted-fg); font-style:italic; background:none; padding:4px 0; }
.msg.error { align-self:center; font-size:11px; color:#dc2626; background:rgba(220,38,38,.05); padding:6px 12px; }

/* Input */
.chat-container-wrap { border-top:1px solid var(--border); display:flex; flex-direction:column; background:var(--card); }

.img-preview-dropzone { display:none; padding:8px 12px; background:#f9fafb; border-bottom:1px solid var(--border); gap:8px; flex-wrap:wrap; align-items:center; }
.img-preview-dropzone.has-images { display:flex; }
.preview-item { position:relative; width:48px; height:48px; border-radius:6px; overflow:hidden; border:1px solid var(--border); }
.preview-item img { width:100%; height:100%; object-fit:cover; }
.preview-item .rm-btn { position:absolute; top:2px; right:2px; width:16px; height:16px; background:rgba(0,0,0,0.6); color:#fff; border:none; border-radius:50%; font-size:10px; line-height:16px; text-align:center; cursor:pointer; padding:0; }

.chat-input { padding:10px 12px; display:flex; gap:6px; align-items:center;}
.chat-input input { flex:1; padding:9px 12px; border:1px solid var(--border); border-radius:8px; font-size:13px; outline:none; background:var(--background); transition:border-color .2s; }
.chat-input input:focus { border-color:var(--primary); }
.chat-input .img-upload-btn { background:var(--muted); color:var(--foreground); border:1px solid var(--border); padding:8px; border-radius:8px; cursor:pointer; font-size:14px; text-align:center; transition:background .2s; }
.chat-input .img-upload-btn:hover { background:#e7e5e2; }
.chat-input button.send-btn { padding:9px 16px; background:var(--primary,#1c1917); color:#fff; border:none; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer; transition:opacity .2s; white-space:nowrap; }
.chat-input button.send-btn:hover { opacity:.85; }
.chat-input button.send-btn:disabled { opacity:.5; cursor:not-allowed; }

/* Thinking */
.thinking { display:flex; gap:4px; padding:8px 13px; }
.thinking span { width:5px; height:5px; border-radius:50%; background:var(--muted-fg); animation:bounce 1.4s ease-in-out infinite; }
.thinking span:nth-child(2) { animation-delay:.2s; }
.thinking span:nth-child(3) { animation-delay:.4s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-7px)} }

/* Markdown formatting inside chat */
.msg.ai a { color:var(--primary); text-decoration:underline; }
.msg.ai strong { font-weight:600; }
.msg.ai img { max-width:100%; border-radius:4px; display:block; margin:4px 0; }
.msg.ai code { background:var(--muted); padding:1px 4px; border-radius:3px; font-size:11.5px; }

/* ═══════ Right: Pipeline ═══════ */
.pipeline-panel { display:flex; flex-direction:column; background:var(--card,#fff); border:1px solid var(--border,#e7e5e2); border-radius:12px; overflow:hidden; }

.pipeline-header { padding:10px 14px; border-bottom:1px solid var(--border); display:flex; align-items:center; gap:8px; }
.pipeline-header h3 { font-size:13px; font-weight:700; margin:0; }
.pipeline-header .path-badge { font-size:10px; padding:2px 8px; background:var(--muted); border-radius:10px; color:var(--muted-fg); font-weight:500; }

.pipeline-steps { flex:1; overflow-y:auto; padding:12px; display:flex; flex-direction:column; gap:0; }
.pipeline-steps::-webkit-scrollbar { width:3px; }
.pipeline-steps::-webkit-scrollbar-thumb { background:rgba(0,0,0,.08); border-radius:4px; }

.p-step { position:relative; padding:10px 12px 10px 28px; margin:0; }
.p-step:not(:last-child) { border-left:2px solid var(--border); margin-left:7px; padding-bottom:14px; }
.p-step:last-child { border-left:2px solid transparent; margin-left:7px; }

.p-step::before { content:''; position:absolute; left:-1px; top:13px; width:10px; height:10px; border-radius:50%; border:2px solid var(--border); background:var(--card); z-index:1; margin-left:-4px; }
.p-step.s-user::before { background:#6366f1; border-color:#6366f1; }
.p-step.s-planner::before { background:#f59e0b; border-color:#f59e0b; }
.p-step.s-tool_result::before { background:#10b981; border-color:#10b981; }
.p-step.s-responder::before { background:#3b82f6; border-color:#3b82f6; }

.p-step .step-label { font-size:11px; font-weight:700; margin-bottom:3px; }
.p-step .step-content { font-size:11.5px; line-height:1.45; color:var(--foreground); white-space:pre-wrap; word-break:break-word; max-height: 200px; overflow-y: auto; }