/* OKHA conversational view, stage 1. Active only when body[data-ui=chat]. */
.chat-room,.chat-sheet-bar{display:none}
body[data-ui=chat][data-view=prepare]:not([data-chat-sheet]) .chat-room:not([hidden]){display:flex}
body[data-ui=chat][data-view=prepare]:not([data-chat-sheet]) main>:not(.chat-room,.connection-line,.update-banner,.sync-conflict-banner,#session-loading){display:none!important}
body[data-ui=chat][data-chat-sheet] main>:is(.page-title,.workflow-switch,#welcome-strip,#member-home,#recent-analyses,#prepared,#workspace-nav,.material-panel,.chat-room){display:none!important}
body[data-ui=chat][data-chat-sheet] .chat-sheet-bar{display:flex;flex-direction:column;position:sticky;top:0;z-index:6;background:var(--bg);border-bottom:1px solid var(--line);margin:0 0 12px}
.cu-sheet-top{display:flex;align-items:center;justify-content:space-between;gap:12px}
.cu-sheet-close{border:0;background:none;padding:0 4px 0 0;color:var(--red);font-size:15px;font-weight:650}
.cu-sheet-title{font-size:14px;font-weight:700;color:var(--muted)}
.cu-sheet-nav{display:flex;gap:18px;overflow-x:auto;scrollbar-width:none;white-space:nowrap}
.cu-sheet-nav::-webkit-scrollbar{display:none}
.cu-sheet-nav button{flex:none;border:0;background:none;padding:0;color:var(--muted);font-size:14px;font-weight:500}
.cu-sheet-nav button[aria-current=true]{color:var(--ink);font-weight:700;box-shadow:inset 0 -2px 0 var(--ink)}
.cu-sheet-nav small{font-size:12px;font-weight:500}
body[data-ui=chat] #result-toc{display:none}

.chat-room{flex-direction:column;width:100%;max-width:720px;margin:0 auto;min-height:calc(100dvh - 96px)}
.cu-head{display:flex;align-items:center;gap:2px;position:sticky;top:0;z-index:4;background:var(--bg);border-bottom:1px solid var(--line);padding:4px 0}
.cu-title{flex:1;min-width:0;margin:0;font-size:17px;font-weight:700;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cu-icon{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;padding:0;border:0;background:none;color:var(--ink)}
.cu-text-button{border:0;background:none;padding:0 6px;color:var(--muted);font-size:13px;font-weight:600}

.cu-list{flex:1;display:flex;flex-direction:column;gap:18px;padding:18px 0 24px}
.cu-msg{display:flex;flex-direction:column;gap:6px;max-width:min(100%,600px)}
.cu-who{font-size:11px;font-weight:700;letter-spacing:.1em;color:var(--red)}
.cu-mine{align-self:flex-end;max-width:min(86%,480px);background:#efe7da;border-radius:14px 14px 4px 14px;padding:10px 12px}
.cu-text{margin:0;font-size:15px;line-height:1.55}
.cu-note{white-space:pre-wrap;overflow-wrap:anywhere}
.cu-sub{margin:0;font-size:13px;line-height:1.5;color:var(--muted)}
.cu-files{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:2px}
.cu-files li{display:flex;align-items:center;gap:8px;font-size:14px;line-height:1.4;color:var(--ink)}
.cu-files li>svg{flex:none;color:var(--muted)}
.cu-files li>span{flex:1;min-width:0;overflow-wrap:anywhere}
.cu-remove{flex:none;border:0;background:none;padding:0 4px;color:var(--muted);font-size:13px;text-decoration:underline;text-underline-offset:3px}
.cu-warn{margin:0;padding-left:18px;font-size:13px;line-height:1.5;color:#8a4b0f}
.cu-actions{display:flex;gap:8px;padding-top:2px}
.cu-primary{border:0;border-radius:10px;background:var(--red);color:#fff;padding:0 18px;font-size:15px;font-weight:650}

.cu-progress{display:flex;align-items:center;gap:10px}
.cu-bar{position:relative;width:180px;height:3px;background:var(--line);overflow:hidden}
.cu-bar>span{position:absolute;inset:0 auto 0 0;width:35%;background:var(--red);animation:cu-slide 1.6s ease-in-out infinite}
@keyframes cu-slide{0%{transform:translateX(-100%)}100%{transform:translateX(290%)}}
@media (prefers-reduced-motion:reduce){.cu-bar>span{animation:none;width:100%;opacity:.5}}
.cu-elapsed{font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}

.cu-card-msg{max-width:min(100%,640px)}
.cu-card{display:flex;flex-direction:column;gap:10px;background:var(--paper);border:1px solid var(--line);border-radius:12px;padding:14px 14px 4px}
.cu-card h2{margin:0;font-size:16px;line-height:1.35}
.cu-company{margin:-6px 0 0;font-size:13px;color:var(--muted)}
.cu-summary .cu-text{font-size:14px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:5;overflow:hidden}
.cu-summary .cu-sub{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;overflow:hidden;margin-top:4px}
.cu-points{margin:0;padding:10px 0 0 18px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:6px;font-size:13px;line-height:1.5}
.cu-points .cu-source{min-height:0;display:inline;font-size:12px;white-space:nowrap}
.cu-check{align-self:flex-start;min-height:32px;margin:0;border:0;background:none;padding:0;text-align:left;font-size:13px;line-height:1.5;color:#8a4b0f;text-decoration:underline;text-decoration-color:rgba(138,75,15,.35);text-underline-offset:3px}
.cu-links{display:flex;flex-wrap:wrap;gap:0 18px;border-top:1px solid var(--line)}
.cu-links button{border:0;background:none;padding:0;color:var(--red);font-size:14px;font-weight:650}

.cu-answer{display:flex;flex-direction:column;gap:4px}
.cu-answer+.cu-answer{border-top:1px solid var(--line);padding-top:10px;margin-top:4px}
.cu-kind{margin:0;font-size:12px;font-weight:650;color:var(--muted)}
.cu-answer p{margin:0 0 4px}
.cu-source,.cu-inline{align-self:flex-start;min-height:32px;border:0;background:none;padding:0;color:var(--red);font-size:13px;font-weight:650}
.cu-inline{min-width:0;min-height:0;text-decoration:underline;text-underline-offset:3px}
.cu-parts summary{cursor:pointer;min-height:44px;display:flex;align-items:center;font-size:14px;color:var(--red);font-weight:650}
.cu-status{margin:0;font-size:13px;line-height:1.5;color:var(--muted)}

.cu-composer{position:sticky;bottom:0;z-index:4;display:flex;align-items:flex-end;gap:6px;background:var(--bg);border-top:1px solid var(--line);padding:8px 0 calc(10px + env(safe-area-inset-bottom))}
.cu-composer textarea{flex:1;min-height:44px;max-height:160px;resize:none;line-height:1.4;padding:10px 12px;overflow-y:auto}
.cu-send{width:44px;height:44px;flex:none;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:10px;background:var(--red);color:#fff}
.cu-file-input{position:absolute;width:1px;height:1px;opacity:0;pointer-events:none}
body[data-ui=chat][data-view=prepare]:not([data-chat-sheet]) main{padding-bottom:0}
body[data-ui=chat] #jump-question{display:none!important}

.cu-tag{font-size:12px;font-weight:650;color:var(--muted);white-space:nowrap}
.cu-tag-warn{color:#8a4b0f}
.cu-phrases{display:flex;flex-direction:column;border-left:2px solid var(--line);padding-left:12px;margin:2px 0 4px}
.cu-phrase{display:flex;align-items:flex-start;gap:8px}
.cu-phrase+.cu-phrase{border-top:1px solid var(--line)}
.cu-phrase p{flex:1;min-width:0;margin:0;padding:10px 0;font-size:15px;line-height:1.5;overflow-wrap:anywhere}
.cu-copy{flex:none;border:0;background:none;padding:0 2px;color:var(--red);font-size:13px;font-weight:650}
body[data-ui=chat] .cu-has-copy{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:10px;align-items:start}
body[data-ui=chat] .cu-has-copy>small{grid-column:1/-1}
body[data-ui=chat] .cu-has-copy>p{grid-column:1;margin:0}
body[data-ui=chat] .cu-has-copy>.cu-copy{grid-column:2;grid-row:2;min-height:32px}
/* In the sheet the full report follows the summary; terms and questions come after it. */
body[data-ui=chat][data-chat-sheet] #full-analysis{order:4}
body[data-ui=chat][data-chat-sheet] #glossary{order:5}
body[data-ui=chat][data-chat-sheet] #company-questions{order:6}
body[data-ui=chat][data-chat-sheet] #partner-panel{order:7}
body[data-ui=chat][data-chat-sheet] #chat-panel{order:8}
body[data-ui=chat][data-chat-sheet] #job-details{order:9}

/* Stage 3: preparation list (the library view in chat mode). */
.cu-list-head{display:none}
body[data-ui=chat][data-view=library] .cu-list-head{display:flex;flex-direction:column;gap:14px;margin:0 0 14px}
.cu-list-head h1{margin:0;font-size:24px;line-height:1.3}
.cu-list-head .cu-primary{width:100%;min-height:52px;font-size:16px}
body[data-ui=chat][data-view=library] :is(.workflow-switch,#library-view>.section-title){display:none!important}
body[data-ui=chat] #library-list .history-row{padding:4px 0}
body[data-ui=chat] #library-list .cu-row{display:flex;flex-direction:column;gap:4px;padding:12px 0}
.cu-row-top{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.cu-row-top strong{min-width:0;font-size:16px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-ui=chat] #library-list .cu-row-top small{flex:none;display:inline;margin:0;font-size:13px;color:var(--muted)}
.cu-row-last{font-size:14px;line-height:1.45;color:#4a433c;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.cu-row-status{font-size:12px;font-weight:650;color:var(--muted)}
.cu-row-status.done{color:var(--red)}
.cu-row-status.warn{color:#8a4b0f}
/* Stage 3: re-analysis confirmation and earlier results. */
.cu-plain{border:0;background:none;padding:0 12px;color:var(--muted);font-size:15px;font-weight:600}
.cu-card-old{background:transparent}
.cu-card-old h2{color:var(--muted);font-size:15px}
/* Stage 3: two-company block in the report sheet. */
.cu-meeting{display:none}
body[data-ui=chat][data-chat-sheet] .cu-meeting{display:block;order:3;margin:8px 0 18px}
.cu-meeting h2{font-size:18px;margin:18px 0 8px}
.cu-meeting ol{margin:0;padding-left:20px}
/* Earlier-material records are already in the conversation; in the sheet they go last. */
body[data-ui=chat][data-chat-sheet] #source-history{order:10}
