{/* Mode tabs */}
{[{id:"nav",icon:,l:"Nav"},{id:"browser",icon:,l:"Browser"},{id:"notes",icon:,l:"Notes"},{id:"web",icon:,l:"Web"}].map(m=>setBrowserMode(m.id)} style={{flex:1,padding:"6px 2px",border:"none",cursor:"pointer",backgroundColor:"transparent",color:browserMode===m.id?c.accentBtn:c.textTer,fontSize:9.5,fontWeight:browserMode===m.id?650:400,fontFamily:font.sans,borderBottom:browserMode===m.id?`2px solid ${c.accentBtn}`:"2px solid transparent",display:"flex",alignItems:"center",justifyContent:"center",gap:3}}>{m.icon}{m.l} )}
{/* ─── NAV MODE ─── */}
{browserMode==="nav"&&
{/* Conversations */}
Conversations
{recentConvos.map(cv=>
openTab("chat",cv.name,"💬")} style={{display:"flex",alignItems:"center",gap:6,padding:"5px 10px",cursor:"pointer",borderRadius:R.sm,margin:"0 4px"}} onMouseEnter={e=>e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>
{cv.starred&&}
{cv.name} {cv.time}
)}
openTab("utility","Chats","💬")} style={{fontSize:10.5,color:c.accentBtn,cursor:"pointer",fontWeight:500}}>See all →
{/* Activity */}
openTab("utility","Activity & Notifications","🔔")} style={{display:"flex",alignItems:"center",gap:6,padding:"6px 0",cursor:"pointer"}}>Activity & Notifications 3
{/* Pages */}
Pages
{navPages.map(p=>
openTab("utility",p.label,p.id==="settings"?"⚙️":"📋")} style={{display:"flex",alignItems:"center",gap:8,padding:"6px 10px",cursor:"pointer",borderRadius:R.sm,margin:"0 4px"}} onMouseEnter={e=>e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>
{p.icon}{p.label}
)}
{/* Open Tabs */}
Open Tabs ({tabs.length})
{tabs.map(t=>
setActiveTabId(t.id)} style={{display:"flex",alignItems:"center",gap:6,padding:"4px 10px",cursor:"pointer",borderRadius:R.sm,margin:"0 4px",backgroundColor:t.id===activeTabId?c.accentBtn+"08":"transparent"}} onMouseEnter={e=>{if(t.id!==activeTabId)e.currentTarget.style.backgroundColor=c.bgInput}} onMouseLeave={e=>{e.currentTarget.style.backgroundColor=t.id===activeTabId?c.accentBtn+"08":"transparent"}}>
{t.icon} {t.title}
)}
}
{/* ─── BROWSER MODE ─── */}
{browserMode==="browser"&&<>
{collections.map(col=>{const sel=selectedCollections.has(col.name);return toggleCollection(col.name)} style={{width:14,height:14,borderRadius:"50%",backgroundColor:col.color,border:sel?`2px solid ${c.textPri}`:"2px solid transparent",cursor:"pointer",flexShrink:0,opacity:sel?1:.6,transition:"all .15s"}}/>})}
{scopeFams.map(s=>setActiveScope(activeScope===s?null:s)} style={{padding:"2px 8px",borderRadius:3,border:`1px solid ${activeScope===s?c.accentBtn+"60":c.borderLight}`,backgroundColor:activeScope===s?c.accentBtn+"10":"transparent",fontSize:10,fontWeight:activeScope===s?600:400,color:activeScope===s?c.accentBtn:c.textTer,cursor:"pointer",fontFamily:font.sans,height:20}}>{s} )}
{typeChips.map(t=>toggleType(t)} style={{padding:"1px 6px",borderRadius:3,border:`1px solid ${activeTypes.has(t)?c.accentBtn+"50":c.borderLight}`,backgroundColor:activeTypes.has(t)?c.accentBtn+"10":"transparent",fontSize:9.5,fontWeight:activeTypes.has(t)?600:400,color:activeTypes.has(t)?c.accentBtn:c.textTer,cursor:"pointer",fontFamily:font.sans,height:18}}>{t} )}{activeTypes.size>0&&setActiveTypes(new Set())} style={{padding:"1px 6px",border:"none",cursor:"pointer",fontSize:9,color:c.textTer,fontFamily:font.sans,height:18}}>clear }
{filtered.length} items {e.stopPropagation();setSortDrop(!sortDrop)}}>{sortKey} ▾ {sortDrop&&
e.stopPropagation()} style={{position:"absolute",top:16,right:0,backgroundColor:c.bgCard,border:`1px solid ${c.border}`,borderRadius:R.sm,boxShadow:"0 4px 12px rgba(0,0,0,0.1)",zIndex:50,minWidth:120,padding:3}}>{["Modified","Alphabetical","Type","Created"].map(s=>{setSortKey(s);setSortDrop(false)}} style={{display:"block",width:"100%",padding:"5px 10px",border:"none",cursor:"pointer",backgroundColor:s===sortKey?c.accentBtn+"08":"transparent",fontSize:11,color:s===sortKey?c.accentBtn:c.textPri,textAlign:"left",borderRadius:R.sm,fontFamily:font.sans,fontWeight:s===sortKey?600:400}}>{s}{s===sortKey&&" ✓"} )}
}
{filtered.map((item,i)=>
setSelectedIdx(i)} style={{display:"flex",alignItems:"center",gap:6,padding:"6px 8px",height:32,borderBottom:`1px solid ${c.borderLight}`,cursor:"pointer",backgroundColor:selectedIdx===i?c.accentBtn+"08":"transparent"}} onMouseEnter={e=>{if(selectedIdx!==i)e.currentTarget.style.backgroundColor=c.bgPanelAlt}} onMouseLeave={e=>{if(selectedIdx!==i)e.currentTarget.style.backgroundColor="transparent"}}>{item.pin&&}{item.title} {item.st&&{item.st} }{item.type} {item.time}
)}
{activeScope||"All"} · {sortKey}
>}
{/* ─── NOTES MODE ─── */}
{browserMode==="notes"&&<>
Notes flash("New note…")} style={{padding:"2px 6px",borderRadius:R.sm,border:`1px solid ${c.border}`,backgroundColor:"transparent",cursor:"pointer",fontSize:9.5,color:c.accentBtn,fontFamily:font.sans}}>+ New
{/* Folder tree */}
{[{id:"nf1",title:"Case Notes",notes:["Today — April 4, 2026","Trial Prep Checklist","Danny Christensen"]},{id:"nf2",title:"Session Notes",notes:["Clips: 4.4-1","Clips: 4.3-1"]}].map(f=>
{const s=new Set(noteExpandedFolders);s.has(f.id)?s.delete(f.id):s.add(f.id);setNoteExpandedFolders(s)}} style={{display:"flex",alignItems:"center",gap:4,padding:"4px 8px",cursor:"pointer",backgroundColor:c.bgPanelAlt,borderBottom:`1px solid ${c.borderLight}`}}>{noteExpandedFolders.has(f.id)?:}{f.title} {f.notes.length}
{noteExpandedFolders.has(f.id)&&f.notes.map((n,i)=>
flash(`Open "${n}"`)} style={{display:"flex",alignItems:"center",gap:4,padding:"4px 10px 4px 22px",height:28,borderBottom:`1px solid ${c.borderLight}`,cursor:"pointer",fontSize:11.5}} onMouseEnter={e=>e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>{n}
)}
)}
>}
{/* ─── WEB MODE ─── */}
{browserMode==="web"&&<>
Bookmarks + Folder
{[{title:"Legal Research",items:["PACER — CACD","Westlaw","CM/ECF Login"]},{title:"Clients",items:["Paramount SharePoint"]},{title:"Reference",items:["Cal. Rules of Court"]}].map((bf,i)=>
{bf.title}
{bf.items.map((item,ii)=>
e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>{item[0]} {item}
)}
)}
Recent Pages
{["Paramount MIL No. 3","SEC — Brooge Energy","LAMC § 14.4.4"].map((t,i)=>
e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>{t[0]} {t}
)}
>}
{const sX=e.clientX,sW=browserWidth;const m=ev=>setBrowserWidth(Math.max(200,Math.min(450,sW+(ev.clientX-sX))));const u=()=>{document.removeEventListener("mousemove",m);document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",m);document.addEventListener("mouseup",u)}}/>
}
{/* ═══ MAIN WORKSPACE ═══ */}
{/* ═══ TAB BAR ═══ */}
setBrowserOpen(!browserOpen)} title="Browser (⌘B)" style={{width:28,height:36,borderRadius:0,border:"none",borderRight:`1px solid ${c.border}`,backgroundColor:browserOpen?c.bgPanel+"cc":"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:browserOpen?c.accentBtn:c.textTer,marginRight:6,flexShrink:0}}>
{/* Render tabs */}
{(()=>{const rendered=new Set();return tabs.map(tab=>{if(rendered.has(tab.id))return null;
if(tab.group){const group=tabGroups.find(g=>g.id===tab.group);if(!group)return null;const gTabs=tabs.filter(t=>t.group===tab.group);if(rendered.has(gTabs[0]?.id)&&gTabs[0]?.id!==tab.id)return null;gTabs.forEach(t=>rendered.add(t.id));
return
setTabGroups(g=>g.map(x=>x.id===group.id?{...x,collapsed:!x.collapsed}:x))} onContextMenu={e=>{e.preventDefault();e.stopPropagation();setGroupCtx({x:e.clientX,y:e.clientY,gid:group.id})}} style={{display:"flex",alignItems:"center",gap:4,padding:"0 6px",height:32,cursor:"pointer",borderRadius:"8px 8px 0 0",backgroundColor:group.color+"30"}}>{group.label} ▾
{!group.collapsed&&gTabs.map(gt=>
setDragTabId(gt.id)} onDragOver={e=>e.preventDefault()} onDrop={()=>handleTabDrop(gt.id)} onClick={()=>setActiveTabId(gt.id)} onContextMenu={e=>{e.preventDefault();setTabContextMenu({x:e.clientX,y:e.clientY,tabId:gt.id})}} style={{display:"flex",alignItems:"center",gap:5,padding:"0 10px",height:32,minWidth:60,maxWidth:180,borderRadius:"8px 8px 0 0",backgroundColor:gt.id===activeTabId?c.bgPanel:"#e8eaed",borderBottom:gt.id===activeTabId?`2.5px solid ${gt.color}`:`2.5px solid ${group.color}40`,cursor:"pointer",overflow:"hidden",flexShrink:1}}>{gt.icon} {gt.title} {e.stopPropagation();closeTab(gt.id)}} style={{cursor:"pointer",display:"flex",opacity:gt.id===activeTabId?1:0,padding:2,borderRadius:3,flexShrink:0}}>
)}
}
rendered.add(tab.id);
const isTransient=tab.type==="utility"&&!tab.pinned;
return
setDragTabId(tab.id)} onDragOver={e=>e.preventDefault()} onDrop={()=>handleTabDrop(tab.id)} onClick={e=>{if(e.metaKey||e.ctrlKey){const s=new Set(selectedTabs);s.has(tab.id)?s.delete(tab.id):s.add(tab.id);setSelectedTabs(s)}else setActiveTabId(tab.id)}} onContextMenu={e=>{e.preventDefault();setTabContextMenu({x:e.clientX,y:e.clientY,tabId:tab.id})}} style={{display:"flex",alignItems:"center",gap:5,padding:"0 10px",height:32,minWidth:isTransient?60:80,maxWidth:180,borderRadius:"8px 8px 0 0",backgroundColor:tab.incognito?(tab.id===activeTabId?"#2d2d2d":"#3a3a3a"):(tab.id===activeTabId?c.bgPanel:"#e8eaed"),borderBottom:isTransient?(tab.id===activeTabId?`2px dashed ${c.neutral}`:"1px solid #ccc"):(tab.id===activeTabId?`2.5px solid ${tab.color}`:`1px solid ${c.border}`),cursor:"pointer",overflow:"hidden",flexShrink:1,opacity:isTransient&&tab.id!==activeTabId?.7:1}}>
{tab.incognito&& }{!tab.incognito&&{tab.icon} }
{tab.title}
{e.stopPropagation();closeTab(tab.id)}} style={{cursor:"pointer",display:"flex",opacity:tab.id===activeTabId?1:0,padding:2,borderRadius:3,flexShrink:0}}>
})})()}
{/* [+] dropdown — expanded */}
{e.stopPropagation();setNewTabDrop(!newTabDrop)}} style={{width:28,height:28,borderRadius:"6px 6px 0 0",border:"none",backgroundColor:"transparent",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:c.textTer,marginBottom:2}}>
{newTabDrop&&
e.stopPropagation()} style={{position:"absolute",top:30,left:0,backgroundColor:c.bgCard,border:`1px solid ${c.border}`,borderRadius:R.sm,boxShadow:"0 4px 16px rgba(0,0,0,0.12)",zIndex:100,minWidth:200,padding:4}}>
Create
{openTab("note","Untitled Note","📝");setNewTabDrop(false)}}>📝 New Note
{openTab("chat","New Chat","💬");setNewTabDrop(false)}}>💬 New Chat
{openTab("web","New Tab","🌐");setNewTabDrop(false)}}>🌐 New Web Tab
{openTab("web","Incognito","🌐",{incognito:true});setNewTabDrop(false)}}> Incognito Tab
Open
{[{l:"Chats",i:"💬"},{l:"Tasks",i:"📋"},{l:"Projects",i:"📁"},{l:"Knowledge Manager",i:"🧠"},{l:"Agents",i:"👤"},{l:"Settings",i:"⚙️"}].map(p=>
{openTab("utility",p.l,p.i);setNewTabDrop(false)}}>{p.i} {p.l} )}
}
{/* Tab context menu */}
{tabContextMenu&&
e.stopPropagation()} style={{position:"fixed",left:tabContextMenu.x,top:tabContextMenu.y,backgroundColor:c.bgCard,border:`1px solid ${c.border}`,borderRadius:R.sm,boxShadow:"0 4px 16px rgba(0,0,0,0.15)",zIndex:9999,minWidth:180,padding:4}}>
{closeTab(tabContextMenu.tabId);setTabContextMenu(null)}}>Close
{flash("Duplicated");setTabContextMenu(null)}}>Duplicate
{(tabs.find(t=>t.id===tabContextMenu.tabId)?.type==="note")&&
{const n=prompt("New name:");if(n)setTabs(p=>p.map(t=>t.id===tabContextMenu.tabId?{...t,title:n}:t));setTabContextMenu(null)}}>Rename }
{tabs.find(t=>t.id===tabContextMenu.tabId)?.type==="utility"&&
{setTabs(p=>p.map(t=>t.id===tabContextMenu.tabId?{...t,pinned:true}:t));setTabContextMenu(null);flash("Pinned — won't auto-close")}}>Pin (keep open) }
{selectedTabs.size>0?
{const gid="g"+Date.now();const nm=prompt("Group name:")||"Group";setTabGroups(p=>[...p,{id:gid,label:nm,color:groupColors[p.length%groupColors.length],collapsed:false}]);setTabs(p=>p.map(t=>selectedTabs.has(t.id)||t.id===tabContextMenu.tabId?{...t,group:gid}:t));setSelectedTabs(new Set());setTabContextMenu(null)}}>Group Selected…
:
{const gid="g"+Date.now();const nm=prompt("Group name:")||"Group";setTabGroups(p=>[...p,{id:gid,label:nm,color:groupColors[p.length%groupColors.length],collapsed:false}]);setTabs(p=>p.map(t=>t.id===tabContextMenu.tabId?{...t,group:gid}:t));setTabContextMenu(null)}}>Group Tab… }
{tabGroups.length>0&&<>{tabGroups.map(g=>
{setTabs(p=>p.map(t=>t.id===tabContextMenu.tabId?{...t,group:g.id}:t));setTabContextMenu(null)}}>Add to {g.label} )}>}
{tabs.find(t=>t.id===tabContextMenu.tabId)?.group&&
{setTabs(p=>p.map(t=>t.id===tabContextMenu.tabId?{...t,group:undefined}:t));setTabContextMenu(null)}}>Remove from Group }
}
{/* Group context menu */}
{groupCtx&&
e.stopPropagation()} style={{position:"fixed",left:groupCtx.x,top:groupCtx.y,backgroundColor:c.bgCard,border:`1px solid ${c.border}`,borderRadius:R.sm,boxShadow:"0 4px 16px rgba(0,0,0,0.15)",zIndex:9999,minWidth:160,padding:4}}>
{const n=prompt("Group name:");if(n)setTabGroups(p=>p.map(g=>g.id===groupCtx.gid?{...g,label:n}:g));setGroupCtx(null)}}>Rename
{groupColors.map(gc=>{setTabGroups(p=>p.map(g=>g.id===groupCtx.gid?{...g,color:gc}:g));setGroupCtx(null)}} style={{width:16,height:16,borderRadius:"50%",backgroundColor:gc,cursor:"pointer",border:"2px solid transparent"}}/>)}
{setTabs(p=>p.map(t=>t.group===groupCtx.gid?{...t,group:undefined}:t));setTabGroups(p=>p.filter(g=>g.id!==groupCtx.gid));setGroupCtx(null)}}>Ungroup
{setTabs(p=>p.filter(t=>t.group!==groupCtx.gid));setTabGroups(p=>p.filter(g=>g.id!==groupCtx.gid));setGroupCtx(null)}}>Close Group
}
{/* ═══ CONTENT + ASK PANEL ═══ */}
{if(bubbleMenu&&!e.target.closest("[data-bubble]"))setBubbleMenu(null)}}>
{/* ─── NOTE/CLIPS TOOLBAR ─── */}
{isNoteType&&
Paragraph H1 H2
B}/>I}/>U}/>
}/>}/>
} onClick={()=>flash("Copied")}/>
} label="Save As…" dropdown/>
} label="Ref" onClick={()=>flash("Ref copied")}/>
} dropdown title="+Module"/>
} active={findBar} onClick={()=>setFindBar(!findBar)}/>
}/>
} label={`${openC.length}`} active={rightOpen&&rightTab==="comments"} onClick={()=>{if(rightOpen&&rightTab==="comments")setRightOpen(false);else{setRightOpen(true);setRightTab("comments")}}}/>
} label="Markup" active={showMarkup} onClick={()=>setShowMarkup(!showMarkup)}/>
} label="2" dropdown active/>
} dropdown/>
{if(rightOpen&&rightTab==="send")setRightOpen(false);else{setRightOpen(true);setRightTab("send")}}} style={{padding:"3px 10px",borderRadius:R.sm,border:`1px solid ${(activeTab.type==="clips"?c.purple:c.accentBtn)}40`,backgroundColor:(rightOpen&&rightTab==="send")?(activeTab.type==="clips"?c.purple:c.accentBtn):(activeTab.type==="clips"?c.purple:c.accentBtn)+"08",cursor:"pointer",display:"flex",alignItems:"center",gap:4,color:(rightOpen&&rightTab==="send")?"#fff":(activeTab.type==="clips"?c.purple:c.accentBtn),fontFamily:font.sans,fontSize:10.5,fontWeight:600,height:26}}>Ask {agent.name}
}
{/* ─── DOC TOOLBAR ─── */}
{activeTab.type==="doc"&&<>Sanli Expert Report PDF
}/>} label="Save As…" dropdown/>} label="To Note"/>} label="Ref"/>}/>} title="Open in app"/>}/>} active={pinned} onClick={()=>{setPinned(!pinned);flash(pinned?"Unpinned":"Pinned")}}/>}/>} label={`${openC.length}`} active={rightOpen&&rightTab==="comments"} onClick={()=>{if(rightOpen&&rightTab==="comments")setRightOpen(false);else{setRightOpen(true);setRightTab("comments")}}}/>} label="Markup" active={showMarkup}/>} label="3" dropdown active/>} label="v2" dropdown/>}/>
{if(rightOpen&&rightTab==="send")setRightOpen(false);else{setRightOpen(true);setRightTab("send")}}} style={{padding:"4px 12px",borderRadius:R.sm,border:`1px solid ${c.accentBtn}40`,backgroundColor:(rightOpen&&rightTab==="send")?c.accentBtn:c.accentBtn+"08",cursor:"pointer",display:"flex",alignItems:"center",gap:5,color:(rightOpen&&rightTab==="send")?"#fff":c.accentBtn,fontFamily:font.sans,fontSize:11.5,fontWeight:600,height:28}}>Ask {agent.name}
>}
{/* ─── WEB TOOLBAR ─── */}
{activeTab.type==="web"&&
{setBookmarked(!bookmarked);flash(bookmarked?"Removed":"Bookmarked")}} style={{width:28,height:28,borderRadius:R.sm,border:"none",cursor:"pointer",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center"}}>
} active={readerMode} onClick={()=>{setReaderMode(!readerMode);flash(readerMode?"Page":"Reader")}}/>} label="Save"/>} label="Clip" onClick={()=>{setClipsCount(n=>n+1);flash("Clipped")}}/>} label={`${openC.length}`} active={rightOpen&&rightTab==="comments"} onClick={()=>{if(rightOpen&&rightTab==="comments")setRightOpen(false);else{setRightOpen(true);setRightTab("comments")}}}/>
{if(rightOpen&&rightTab==="send")setRightOpen(false);else{setRightOpen(true);setRightTab("send")}}} style={{padding:"3px 10px",borderRadius:R.sm,border:`1px solid ${c.accentBtn}40`,backgroundColor:(rightOpen&&rightTab==="send")?c.accentBtn:c.accentBtn+"08",cursor:"pointer",display:"flex",alignItems:"center",gap:4,color:(rightOpen&&rightTab==="send")?"#fff":c.accentBtn,fontFamily:font.sans,fontSize:10.5,fontWeight:600,height:26}}>Ask {agent.name}
}
{findBar&&0/0 setFindBar(false)} style={{padding:2,border:"none",cursor:"pointer",backgroundColor:"transparent",display:"flex",color:c.textTer}}>
}
{/* ─── NOTE CONTENT ─── */}
{activeTab.type==="note"&&
Paramount · 📌 Pinned
Trial May 4 — 30 days out. Focus items for today.
Expert Motions
Finalize MIL No. 3 — Sanli discount rate argument. Cross-reference with Christensen opinions.
📋 Task List
{[{text:"Finalize MIL No. 3 re: Sanli",done:false,due:"Apr 7"},{text:"Review Christensen engagement",done:true,due:"Apr 3"},{text:"Prep Sanli depo cross-exam",done:false,due:"Apr 10"}].map((t,i)=>
{t.text} {t.due}
)}
Next Steps
Prepare updated privilege log with Bates-stamp cross-references.
}
{/* ─── DOC CONTENT ─── */}
{activeTab.type==="doc"&&<>Expert Report of Dr. Mehmet Sanli I. Summary Plaintiff's damages of $4.2M are speculative. Actual: ~$380,000.
Using willing buyer-willing seller framework with 18% discount rate.
Paramount · v2 · 3 pending · 1d
>}
{/* ─── WEB CONTENT ─── */}
{activeTab.type==="web"&&{activeTab.incognito&&
Incognito — no history, no signals
}
United States District Court — CACD
PARAMOUNT CONTRACTORS v. CITY OF LOS ANGELES
Case No. BC587659 | Filed: March 15, 2026
MOTION IN LIMINE NO. 3 Dr. Sanli's methodology: (1) improper framework; (2) ignoring City valuations; (3) discount rate of 18% unsupported by comparables.
}
{/* ─── CLIPS CONTENT ─── */}
{activeTab.type==="clips"&&✂️ Clips: 4.4-1
Session Active Paramount · Auto-created
{[{src:"Sanli Report.pdf",text:"Actual damages ~$380,000 using 18% discount rate.",time:"12:34 PM"},{src:"PACER — MIL No. 3",text:"Discount rate of 18% unsupported by comparable data.",time:"12:41 PM"}].map((clip,i)=>
{clip.src} {clip.time} flash("Clip removed")} style={{cursor:"pointer",display:"flex",color:c.textTer,opacity:.5}}>
{clip.text}
)}
Add notes below clips…
}
{/* ─── CHAT TAB CONTENT ─── */}
{activeTab.type==="chat"&&
💬 {activeTab.title}
{[{author:"You",body:"Analyze Sanli's discount rate methodology and identify weaknesses for the MIL.",time:"1h ago"},{author:agentName,body:"Dr. Sanli uses an 18% discount rate but cites no comparable transactions. Three signage-rights transactions I found show rates of 8-12%. His rate appears selected to minimize recovery. This is a strong Sargon argument — the rate lacks evidentiary support.",time:"55m ago"},{author:"You",body:"Can we tie this to the Henderson v. Pacific line?",time:"50m ago"}].map((msg,i)=>
{msg.author} {msg.time}
{msg.body}
)}
flash("Sent")}> Send
}
{/* ─── UTILITY TAB CONTENT ─── */}
{activeTab.type==="utility"&&
{activeTab.icon} {activeTab.title}
transient
{/* Chats management page */}
{activeTab.title==="Chats"&&
{["All","Starred","Active","Archived"].map((f,i)=>{f} )}
{recentConvos.map(cv=>
openTab("chat",cv.name,"💬")} style={{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:R.sm,border:`1px solid ${c.borderLight}`,marginBottom:6,cursor:"pointer"}} onMouseEnter={e=>e.currentTarget.style.backgroundColor=c.bgInput} onMouseLeave={e=>e.currentTarget.style.backgroundColor="transparent"}>
{e.stopPropagation();flash(cv.starred?"Unstarred":"Starred")}} style={{border:"none",background:"none",cursor:"pointer",display:"flex"}}>
{cv.name}
Last message preview…
{cv.time}
)}
}
{/* Generic utility page */}
{activeTab.title!=="Chats"&&
{activeTab.title} page content goes here. This is a transient tab — it auto-closes when you switch away. Right-click → Pin to keep it open.
}
}
{/* Bubble menu */}
{bubbleMenu&&
{setNewCm({text:bubbleMenu.text});setBubbleMenu(null);setRightOpen(true);setRightTab("comments")}} style={{padding:"5px 10px",borderRadius:R.sm,border:"none",cursor:"pointer",backgroundColor:c.accentBtn,color:"#fff",fontSize:11,fontWeight:600,fontFamily:font.sans,display:"flex",alignItems:"center",gap:4}}>Comment
{flash(`Sent to ${agent.name}`);dismissBubble()}} style={{padding:"5px 8px",borderRadius:R.sm,border:"none",cursor:"pointer",backgroundColor:"transparent",color:c.textSec,fontSize:11,fontFamily:font.sans,display:"flex",alignItems:"center",gap:3}}>Ask {agent.name}
{activeTab.type==="web"&&{setClipsCount(n=>n+1);flash("Clipped");dismissBubble()}} style={{padding:"5px 8px",borderRadius:R.sm,border:"none",cursor:"pointer",backgroundColor:"transparent",color:c.textSec,fontSize:11,fontFamily:font.sans,display:"flex",alignItems:"center",gap:3}}>Clip }
}
{/* ═══ ASK AGENT + COMMENTS PANEL ═══ */}
{rightOpen&&
{const sX=e.clientX,sW=rightWidth;const m=ev=>setRightWidth(Math.max(240,Math.min(450,sW-(ev.clientX-sX))));const u=()=>{document.removeEventListener("mousemove",m);document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",m);document.addEventListener("mouseup",u)}}/>
setRightTab("comments")} style={{flex:1,padding:"7px 0",border:"none",cursor:"pointer",backgroundColor:rightTab==="comments"?c.bgPanelAlt:c.bgInput,color:rightTab==="comments"?c.accentBtn:c.textTer,fontSize:10.5,fontWeight:rightTab==="comments"?650:450,fontFamily:font.sans,borderBottom:rightTab==="comments"?`2px solid ${c.accentBtn}`:"2px solid transparent",display:"flex",alignItems:"center",justifyContent:"center",gap:3}}>Comments ({openC.length})
setRightTab("send")} style={{flex:1,padding:"7px 0",border:"none",cursor:"pointer",backgroundColor:rightTab==="send"?c.bgPanel:c.bgInput,color:rightTab==="send"?c.accentBtn:c.textTer,fontSize:10.5,fontWeight:rightTab==="send"?650:450,fontFamily:font.sans,borderBottom:rightTab==="send"?`2px solid ${c.accentBtn}`:"2px solid transparent",display:"flex",alignItems:"center",justifyContent:"center",gap:3}}>Ask {agent.name}
setRightOpen(false)} style={{width:26,border:"none",cursor:"pointer",backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",color:c.textTer}}>
{/* Comments */}
{rightTab==="comments"&&
{newCm&&
{newCm.text&&
"{newCm.text.slice(0,80)}"
}
}
{openC.length>0&&
Open ({openC.length})
}
{openC.map(cm=>
)}
{resolvedC.length>0&&Resolved ({resolvedC.length})
}
{resolvedC.map(cm=>)}
setNewCm({text:""})}>Add general comment…
}
{/* Ask {Agent} with inline response */}
{rightTab==="send"&&<>
{/* Context card */}
{activeTab.icon} {activeTab.title}
{activeTab.type==="web"?"ecf.cacd.uscourts.gov · 4,200 words":activeTab.type==="doc"?"PDF document":isNoteType?"Tiptap note":"Content"}
{/* Agent */}
Agent
{e.stopPropagation();setAgentDrop(!agentDrop)}} style={{display:"flex",alignItems:"center",gap:6,padding:"7px 10px",borderRadius:R.sm,border:`1px solid ${c.border}`,backgroundColor:c.bgCard,cursor:"pointer"}}>
{agent.name} {agentDrop&&
{agents.map((a,i)=>
{setAgentIdx(i);setAgentDrop(false)}}>{a.name}{i===agentIdx&&} )}
}
{/* Instruction */}
Ask about this {activeTab.type}
{/* Include */}
{/* Attach */}
flash("Attach…")} style={{display:"flex",alignItems:"center",gap:4,padding:"5px 10px",borderRadius:R.sm,border:`1px solid ${c.border}`,backgroundColor:"transparent",cursor:"pointer",fontSize:11,color:c.textSec,fontFamily:font.sans}}>Attach file
Ask {agent.name}
{/* Inline agent response */}
{agentResponse&&
{agent.name} {agentResponse.time}
{agentResponse.text}
{openTab("chat",`${activeTab.title} follow-up`,"💬");setAgentResponse(null)}} style={{fontSize:11,color:c.accentBtn,cursor:"pointer",fontWeight:500}}>Continue in full chat →
}
{/* Quick actions for web */}
{activeTab.type==="web"&&
Quick Actions
flash("Saved as artifact")}>Artifact flash("Saved as note")}>Note flash("Pinned")}>Pin
}
>}
}
{/* Downloads tray */}
{showDownloads&&{[{name:"MIL_3.pdf",size:"2.1 MB",done:true},{name:"Sanli_Expert.pdf",size:"8.4 MB",done:false,progress:67}].map((d,i)=>{d.name} {d.done?
✓ :
)}
setShowDownloads(false)}> }
{/* Status bar */}
{Math.floor(sessionMinutes/60)}h {sessionMinutes%60}m
· {clipsCount} clips
· {tabs.length} tabs
{!showDownloads&&<>· setShowDownloads(true)}> 2 >}
{isNoteType&&<>· Saved 2m ago >}
flash("New session")}>New Session
· 100%
{/* ═══ RIGHT CHAT COLUMN — separate from Ask panel ═══ */}
{chatColumnOpen&&
Chat
setChatColumnOpen(false)} style={{border:"none",background:"none",cursor:"pointer",display:"flex",color:c.textTer}}>
{/* Chat selector */}
Paramount damages
{/* Messages */}
{[{from:"You",text:"What's the strongest argument against Sanli's 18% rate?",time:"2m"},{from:agentName,text:"The lack of comparable transaction support. Three signage-rights deals averaged 8-12%. His rate is an unsupported outlier that exists solely to minimize damages. This is exactly the kind of methodology Sargon was designed to exclude.",time:"1m"}].map((m,i)=>
)}
{/* Input */}
}
);
}