:root{--navy:#0f172a;--navy-mid:#1e293b;--blue:#1d4ed8;--blue-hover:#1e40af;--blue-light:#eff6ff;--bg:#f1f5f9;--border:#e2e8f0;--text:#0f172a;--text-2:#475569;--text-3:#94a3b8;--white:#ffffff;--bg-2:#f8fafc;--radius-sm:8px;--radius:12px}*{box-sizing:border-box;margin:0;padding:0}body,html{height:100%}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif;background:var(--bg);height:100vh;overflow:hidden}.layout{display:flex;height:100vh}.sidebar{width:240px;background:var(--navy);display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;transition:width .25s ease}.sidebar-brand{gap:12px;padding:20px;border-bottom:1px solid rgba(255,255,255,.07)}.brand-icon,.sidebar-brand{display:flex;align-items:center}.brand-icon{width:36px;height:36px;background:var(--blue);border-radius:10px;justify-content:center;color:white;font-weight:700;font-size:16px;flex-shrink:0}.brand-name{font-size:15px;font-weight:600;color:white}.brand-sub{font-size:11px;color:rgba(255,255,255,.4);margin-top:2px}.sidebar-section{padding:20px;flex:1 1;display:flex;flex-direction:column;gap:8px;min-height:0}.section-label{font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.8px;color:rgba(255,255,255,.3);margin-bottom:4px}.sidebar-section input{width:100%;padding:9px 12px;background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.1);border-radius:var(--radius-sm);color:white;font-size:14px;outline:none;transition:border-color .15s}.sidebar-section input::placeholder{color:rgba(255,255,255,.28)}.sidebar-section input:focus{border-color:var(--blue)}.sidebar-footer{padding:16px 20px;border-top:1px solid rgba(255,255,255,.07);font-size:12px;color:rgba(255,255,255,.3);flex-shrink:0}.status-dot{width:7px;height:7px;border-radius:50%;background:#22c55e;display:inline-block;margin-right:6px;vertical-align:middle}.user-row{display:flex;gap:6px}.user-row input{flex:1 1}.btn-icon{padding:9px 10px;background:rgba(255,255,255,.08);color:rgba(255,255,255,.6);border:1px solid rgba(255,255,255,.1);border-radius:var(--radius-sm);cursor:pointer;font-size:13px;flex-shrink:0;transition:all .15s}.btn-icon:hover{background:var(--blue);color:white;border-color:var(--blue)}.chats-header{justify-content:space-between;margin-top:16px;margin-bottom:6px}.btn-new-chat,.chats-header{display:flex;align-items:center}.btn-new-chat{width:22px;height:22px;background:rgba(255,255,255,.08);color:rgba(255,255,255,.6);border:1px solid rgba(255,255,255,.12);border-radius:6px;cursor:pointer;font-size:16px;line-height:1;justify-content:center;transition:all .15s}.btn-new-chat:hover{background:var(--blue);border-color:var(--blue);color:white}.chat-list{display:flex;flex-direction:column;gap:2px;overflow-y:auto;flex:1 1;min-height:0}.chat-list::-webkit-scrollbar{width:3px}.chat-list::-webkit-scrollbar-track{background:transparent}.chat-list::-webkit-scrollbar-thumb{background:rgba(255,255,255,.1);border-radius:99px}.chat-list.locked .chat-item:not(.active){opacity:.4;cursor:not-allowed}.chat-item{display:flex;align-items:center;gap:6px;padding:7px 10px;border-radius:var(--radius-sm);cursor:pointer;color:rgba(255,255,255,.5);font-size:13px;transition:all .12s}.chat-item:hover{background:rgba(255,255,255,.06);color:rgba(255,255,255,.8)}.chat-item.active{background:rgba(29,78,216,.35);color:white}.chat-item-name{flex:1 1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-item-del{opacity:0;background:none;border:none;color:rgba(255,255,255,.35);cursor:pointer;font-size:12px;padding:0 2px;line-height:1;flex-shrink:0;transition:color .12s}.chat-item:hover .chat-item-del{opacity:1}.chat-item-del:hover{color:#ef4444}.chat-pane{flex:1 1;display:flex;flex-direction:column;overflow:hidden;min-width:0}.resize-handle{width:8px;flex-shrink:0;cursor:col-resize;position:relative;z-index:20;-webkit-user-select:none;-moz-user-select:none;user-select:none;transition:background .15s}.resize-handle:after{content:"";position:absolute;top:0;bottom:0;left:50%;width:1px;background:var(--border);transition:background .15s}.resize-handle:hover:after{background:var(--blue);width:3px;left:calc(50% - 1px)}.resize-handle[data-open=false]{cursor:default}.resize-handle[data-open=false]:after{display:none}.sidebar-toggle{background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.12);color:rgba(255,255,255,.6);font-size:14px;cursor:pointer;width:26px;height:26px;border-radius:6px;display:flex;align-items:center;justify-content:center;line-height:1;transition:color .15s,background .15s,border-color .15s;flex-shrink:0}.sidebar-toggle:hover{color:white;background:rgba(255,255,255,.16);border-color:rgba(255,255,255,.2)}.sidebar-toggle.right{background:var(--bg);border:1px solid var(--border);color:var(--text-3);margin-right:4px}.sidebar-toggle.right:hover{color:var(--text);background:var(--border)}.panel-reopen{position:absolute;top:12px;left:50%;transform:translateX(-50%);width:20px;height:32px;background:white;border:1px solid var(--border);border-radius:99px;color:var(--text-3);font-size:11px;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.08);transition:color .15s,box-shadow .15s;z-index:1}.panel-reopen:hover{color:var(--blue);box-shadow:0 2px 8px rgba(0,0,0,.12)}.right-sidebar{width:220px;background:var(--white);border-left:1px solid var(--border);display:flex;flex-direction:column;flex-shrink:0;overflow-x:hidden;overflow-y:auto;transition:width .25s ease}.right-sidebar::-webkit-scrollbar{width:3px}.right-sidebar::-webkit-scrollbar-track{background:transparent}.right-sidebar::-webkit-scrollbar-thumb{background:var(--border);border-radius:99px}.right-sidebar-header{padding:10px 16px 10px 12px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.8px;color:var(--text-3);border-bottom:1px solid var(--border);flex-shrink:0;display:flex;align-items:center;gap:8px}.right-sidebar-empty{padding:16px;font-size:12px;color:var(--text-3);line-height:1.55}.file-section{padding:10px 8px 4px}.file-section-header{display:flex;align-items:center;gap:6px;width:100%;background:none;border:none;cursor:pointer;padding:5px 8px;border-radius:var(--radius-sm);font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.7px;color:var(--text-3);font-family:inherit;transition:background .12s,color .12s}.file-section-header:hover{background:var(--bg);color:var(--text-2)}.file-section-header>span:first-child{flex:1 1;text-align:left}.file-section-count{background:var(--bg);border-radius:99px;padding:1px 6px;font-size:10px}.file-section-chevron{font-size:9px;opacity:.6}.file-section-items{max-height:240px;overflow-y:auto;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--bg-2);margin:4px 4px 6px;padding:4px 0}.file-section-items::-webkit-scrollbar{width:5px}.file-section-items::-webkit-scrollbar-track{background:var(--bg)}.file-section-items::-webkit-scrollbar-thumb{background:var(--text-3);border-radius:99px}.file-item{display:flex;align-items:center;padding:2px 6px 2px 0;border-radius:var(--radius-sm);transition:background .12s;position:relative}.file-item:hover{background:var(--bg)}.file-item:hover .file-del{opacity:1}.file-item-main{display:flex;align-items:center;gap:7px;flex:1 1;min-width:0;padding:8px 4px 6px 10px;border:none;background:none;cursor:pointer;text-align:left;color:var(--text-2);font-size:12.5px;font-family:inherit}.file-item:hover .file-item-main{color:var(--text)}.file-del{flex-shrink:0;opacity:0;background:none;border:none;color:var(--text-3);cursor:pointer;font-size:14px;line-height:1;padding:2px 5px;border-radius:4px;transition:opacity .12s,color .12s}.file-del:hover{color:#ef4444}.file-item-confirm{display:flex;align-items:center;gap:4px;padding-right:4px;flex-shrink:0}.file-del-yes{font-size:11px;font-family:inherit;padding:2px 7px;border-radius:4px;border:1px solid #ef4444;background:#fef2f2;color:#ef4444;cursor:pointer;font-weight:500;transition:background .12s}.file-del-yes:hover{background:#fee2e2}.file-del-no{background:none;border:none;color:var(--text-3);cursor:pointer;font-size:14px;padding:2px 4px;border-radius:4px}.file-del-no:hover{color:var(--text)}@keyframes file-highlight{0%{background:#dbeafe}60%{background:#dbeafe}to{background:transparent}}.file-item--highlighted{animation:file-highlight 4s ease-out forwards}.file-item-icon{flex-shrink:0;display:flex;align-items:center;color:var(--text-3)}.file-item-info{flex:1 1;display:flex;flex-direction:column;min-width:0;gap:1px}.file-item-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12.5px}.file-item-date{font-size:10.5px;color:var(--text-3)}.file-modal-overlay{position:fixed;inset:0;background:rgba(15,23,42,.5);display:flex;align-items:center;justify-content:center;z-index:100;padding:24px}.file-modal{background:var(--white);border-radius:var(--radius);box-shadow:0 20px 60px rgba(0,0,0,.2);display:flex;flex-direction:column;width:100%;max-width:860px;min-height:320px;max-height:calc(100vh - 48px);overflow:hidden}.file-modal-header{display:flex;align-items:center;justify-content:space-between;padding:14px 18px;border-bottom:1px solid var(--border);flex-shrink:0}.file-modal-title{font-size:14px;font-weight:600;color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-modal-close{background:none;border:none;color:var(--text-3);font-size:16px;cursor:pointer;padding:2px 6px;border-radius:4px;transition:color .12s;flex-shrink:0}.file-modal-close:hover{color:var(--text)}.file-modal-spinner{flex:1 1;display:flex;align-items:center;justify-content:center}.file-modal-spinner span{width:32px;height:32px;border-radius:50%;border:3px solid var(--border);border-top-color:var(--blue);animation:modal-spin .7s linear infinite}@keyframes modal-spin{to{transform:rotate(1turn)}}.file-modal-body{flex:1 1;overflow:auto;display:flex;flex-direction:column}.file-modal-iframe{width:100%;flex:1 1;border:none;min-height:520px}.file-modal-pre,.file-modal-prose{padding:20px 24px;overflow-y:auto}.file-modal-pre{font-family:SF Mono,Fira Code,Consolas,monospace;font-size:13px;line-height:1.6;white-space:pre-wrap;word-break:break-all;color:var(--text)}.file-modal-csv-wrap{overflow:auto;padding:16px}.file-modal-csv{width:100%;border-collapse:collapse;font-size:13px}.file-modal-csv th{background:#f8fafc;border:1px solid var(--border);padding:8px 12px;text-align:left;font-weight:600;color:var(--text-2);white-space:nowrap}.file-modal-csv td{border:1px solid var(--border);padding:7px 12px}.file-modal-csv tr:nth-child(2n) td{background:#fafafa}.messages{flex:1 1;overflow-y:auto;padding:28px max(32px,calc(50% - 400px)) 16px;display:flex;flex-direction:column;gap:20px;scroll-behavior:smooth}.messages::-webkit-scrollbar{width:4px}.messages::-webkit-scrollbar-track{background:transparent}.messages::-webkit-scrollbar-thumb{background:var(--border);border-radius:99px}.msg-row{display:flex;gap:10px;align-items:flex-start}.msg-row.user{flex-direction:row-reverse;align-self:flex-end;max-width:68%}.msg-row.agent{align-self:flex-start;max-width:85%}.msg-row.sys{align-self:center}.avatar{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;flex-shrink:0;margin-top:2px}.agent-av{background:var(--navy);color:white}.user-av{background:#bfdbfe;color:#1e40af}.bubble{padding:11px 16px;border-radius:var(--radius);font-size:14px;line-height:1.65}.bubble.user{background:var(--blue);color:white;border-radius:var(--radius) var(--radius) 4px var(--radius);white-space:pre-wrap}.bubble.agent{background:var(--white);color:var(--text);border:1px solid var(--border);border-radius:var(--radius) var(--radius) var(--radius) 4px;box-shadow:0 1px 3px rgba(0,0,0,.05)}.bubble.sys{background:white;color:var(--text-2);font-size:12px;border-radius:99px;padding:5px 14px;border:1px solid var(--border)}.bubble.agent p{margin:0 0 10px}.bubble.agent p:last-child{margin-bottom:0}.bubble.agent h1,.bubble.agent h2,.bubble.agent h3{margin:18px 0 6px;line-height:1.3;color:var(--text)}.bubble.agent h1:first-child,.bubble.agent h2:first-child,.bubble.agent h3:first-child{margin-top:0}.bubble.agent h1{font-size:16px}.bubble.agent h2{font-size:15px}.bubble.agent h3{font-size:14px;font-weight:600}.bubble.agent ol,.bubble.agent ul{margin:6px 0 10px}.bubble.agent li{margin:4px 0}.bubble.agent code{background:#f1f5f9;padding:1px 5px;border-radius:4px;font-family:SF Mono,Fira Code,Consolas,monospace;font-size:12.5px;color:#be185d}.bubble.agent{min-width:0}.bubble.agent pre{background:#f1f5f9;color:#1e293b;border:1px solid #e2e8f0;padding:14px 16px;border-radius:var(--radius-sm);overflow-x:auto;margin:10px 0;max-width:100%}.bubble.agent pre code{background:none;color:inherit;padding:0;font-size:13px;border-radius:0}.bubble.agent table{width:100%;border-collapse:collapse;margin:10px 0;font-size:13px}.bubble.agent th{background:#f8fafc;text-align:left;font-weight:600;color:var(--text-2)}.bubble.agent td,.bubble.agent th{border:1px solid var(--border);padding:8px 12px}.bubble.agent tr:nth-child(2n) td{background:#fafafa}.bubble.agent strong{font-weight:600;color:var(--text)}.bubble.agent hr{border:none;height:1px;background:var(--border);margin:14px 0}.bubble.agent blockquote{border-left:3px solid var(--blue);background:var(--blue-light);border-radius:0 var(--radius-sm) var(--radius-sm) 0;padding:10px 14px;margin:14px 0;color:var(--text)}.bubble.agent blockquote p{margin:0}.bubble.agent p{margin:0 0 12px}.bubble.agent ol,.bubble.agent ul{padding-left:20px;margin:8px 0 14px}.bubble.agent li{margin:8px 0;line-height:1.55}.bubble.agent li>strong:first-child,.stat-chip{color:var(--blue)}.stat-chip{display:inline-block;background:#eff6ff;font-weight:600;padding:0 5px;border-radius:4px;font-size:.88em;letter-spacing:.01em}.bubble.agent a{color:var(--blue);text-decoration:none;border-bottom:1.5px solid #bfdbfe;padding-bottom:1px;transition:border-color .15s,color .15s}.bubble.agent a:hover{color:var(--blue-hover);border-bottom-color:var(--blue)}.stream-dots{display:flex;gap:4px;align-items:center}.stream-dots span{width:5px;height:5px;border-radius:50%;background:var(--text-3);animation:dot-pulse 1.4s ease-in-out infinite}.stream-dots span:nth-child(2){animation-delay:.2s}.stream-dots span:nth-child(3){animation-delay:.4s}@keyframes dot-pulse{0%,60%,to{opacity:.2;transform:scale(.75)}30%{opacity:1;transform:scale(1)}}.stream-col{display:flex;flex-direction:column;gap:6px;flex:1 1;min-width:0}.stream-thoughts{display:flex;flex-direction:column;gap:4px;border-left:2px solid var(--border);padding-left:14px}.stream-thought-item{font-size:12px;color:var(--text-3);line-height:1.4;position:relative;padding-left:12px}.stream-thought-item:before{content:"";position:absolute;left:0;top:6px;width:4px;height:4px;border-radius:50%;background:var(--text-3);opacity:.45}.stream-idle{display:inline-flex;align-items:center;gap:8px;padding:11px 16px;background:var(--bg-2);border:1px solid var(--border);border-radius:var(--radius);align-self:flex-start}.stream-cursor{display:flex;margin-top:12px}.tool-chip{background:var(--bg-2);border:1px solid var(--border);border-radius:20px;padding:1px 8px}.steps-toggle,.tool-chip{font-size:11.5px;color:var(--text-3)}.steps-toggle{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;background:none;border:none;cursor:pointer;padding:0;font-family:inherit;line-height:1}.steps-toggle:hover{color:var(--text-2)}.steps-expanded{display:flex;flex-direction:column;gap:4px;border-left:2px solid var(--border);padding-left:14px}.steps-expanded .stream-step{font-size:12px;color:var(--text-3);line-height:1.4;position:relative;padding-left:12px}.steps-expanded .stream-step:before{content:"";position:absolute;left:0;top:6px;width:4px;height:4px;border-radius:50%;background:var(--text-3);opacity:.45}.input-area{padding:12px max(20px,calc(50% - 400px)) 20px;background:var(--bg);display:flex;gap:8px;align-items:center}#chat-input{flex:1 1;padding:10px 14px;border:1px solid var(--border);border-radius:var(--radius);font-size:14px;font-family:inherit;line-height:1.55;outline:none;resize:none;max-height:160px;overflow-y:auto;transition:border-color .15s,box-shadow .15s;background:white;box-shadow:0 1px 4px rgba(0,0,0,.06)}#chat-input:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(59,130,246,.1)}#send-btn{width:36px;height:36px;background:var(--blue);color:white;border:none;border-radius:var(--radius-sm);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s}#send-btn:hover{background:var(--blue-hover)}#send-btn:disabled{background:var(--text-3);cursor:not-allowed}.error-msg{color:#dc2626;font-style:normal;font-size:.9rem}.toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#1e293b;color:#f1f5f9;padding:10px 18px;border-radius:8px;font-size:.85rem;pointer-events:none;z-index:1000;animation:toast-in .15s ease}@keyframes toast-in{0%{opacity:0;transform:translateX(-50%) translateY(8px)}to{opacity:1;transform:translateX(-50%) translateY(0)}}