/* Conversation owns the flexible space; controls never push it off screen. */
.desk-chat:not([hidden]){display:flex;flex-direction:column;width:520px;height:min(900px,calc(100dvh - 32px));max-height:calc(100dvh - 32px);right:16px;bottom:16px;overflow:hidden}
.desk-chat.chat-expanded:not([hidden]){width:min(900px,calc(100vw - 32px));height:calc(100dvh - 32px)}
.desk-chat>header{flex:none;padding:10px 14px;gap:12px;min-height:52px}
.desk-chat>header strong{font-size:16px}.chat-header-actions{display:flex;gap:6px;flex:none}.chat-header-actions button{padding:6px 10px;font-size:12px;min-height:34px}
.desk-chat>#desk-chat-context{flex:none;padding:8px 14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:12px}
.chat-toolbar{display:flex;flex:none;gap:6px;align-items:center;padding:7px 14px;border-bottom:1px solid var(--desk-line)}
.chat-toolbar select{min-width:0;flex:1;max-width:none;min-height:34px;font-size:13px;padding:6px 8px}.chat-toolbar button{font-size:12px;padding:6px 9px;min-height:34px}
#chat-status{flex:none;font-size:12px;padding:0 14px;margin:5px 0;color:var(--desk-muted);min-height:17px}
.chat-turns{flex:1 1 0;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable;padding:14px 18px;line-height:1.75;font-size:15px}
.chat-turn{margin-bottom:22px;overflow-wrap:anywhere}.chat-question{padding:10px 12px;background:var(--desk-bg);border-radius:10px;white-space:pre-wrap;font-size:14px;margin:0 0 8px}
.chat-answer{margin:10px 0}.chat-answer p{white-space:pre-wrap;margin:12px 0}.chat-answer h3{font-size:17px;line-height:1.5;margin:20px 0 8px;scroll-margin-top:120px}.chat-answer ul,.chat-answer ol{padding-left:24px;margin:10px 0}.chat-answer li{white-space:pre-wrap;margin:6px 0}.chat-answer pre{white-space:pre-wrap;overflow-wrap:anywhere;padding:12px;background:var(--desk-bg);border-radius:10px;font:13px/1.7 monospace}.chat-error{color:#b42318}.chat-turn small,.chat-empty p{color:var(--desk-muted)}
.chat-answer-nav{position:sticky;top:0;z-index:1;display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:6px;padding:8px 0;background:var(--desk-panel);border-bottom:1px solid var(--desk-line)}.chat-answer-nav button{font-size:13px;line-height:1.4;min-height:40px;text-align:left;padding:8px 10px;overflow-wrap:anywhere}
.chat-turn .chat-question-details{margin-top:0;padding:6px 10px;font-size:12px;color:var(--desk-muted)}.chat-question-details summary{cursor:pointer}.chat-question-details .chat-question{margin-top:8px}
.chat-turn details{border:1px solid var(--desk-line);border-radius:8px;padding:10px;margin-top:10px}.chat-citation{padding:8px 0;border-bottom:1px solid var(--desk-line)}.chat-citation p{font-size:12px;white-space:pre-wrap}
.chat-form{flex:none;margin:0;padding:8px 14px 10px;border-top:1px solid var(--desk-line);background:var(--desk-panel)}
.chat-source-settings{font-size:12px;color:var(--desk-muted);max-height:130px;overflow-y:auto;margin:0 0 6px}.chat-source-settings summary{cursor:pointer;padding:3px 0}.chat-source-settings label{font-size:12px}.chat-source-settings select{max-width:100%;min-height:32px;padding:5px 8px}.chat-source-settings p{font-size:11px;margin:6px 0}.chat-source-settings button{font-size:12px;padding:5px 8px}
.chat-form textarea{min-height:56px;max-height:100px;width:100%;resize:vertical;font:14px/1.5 -apple-system,sans-serif;padding:10px;margin:0 0 6px}
.chat-actions{display:flex;gap:8px;align-items:center}.chat-actions .primary{margin:0 0 0 auto}.chat-actions button{min-height:36px;padding:7px 12px;font-size:13px}.chat-shortcut{font-size:11px;color:var(--desk-muted)}
.chat-analysis{border-top:1px solid var(--desk-line);padding:8px 14px;max-height:22%;overflow:auto;flex:none;font-size:12px}.chat-analysis:not([open]){max-height:36px}.chat-analysis .chat-body{padding:10px 0}.chat-analysis summary{cursor:pointer;color:var(--desk-muted)}
.chat-form .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:560px){.desk-chat:not([hidden]),.desk-chat.chat-expanded:not([hidden]){right:8px;bottom:8px;width:calc(100vw - 16px);max-width:calc(100vw - 16px);height:calc(100dvh - 16px);max-height:calc(100dvh - 16px)}.chat-turns{padding:12px 14px;font-size:15px}.chat-toolbar{padding:6px 10px}.chat-form{padding:8px 10px}.chat-form textarea,.chat-form select{font-size:16px}.chat-shortcut{display:none}.chat-header-actions button{min-height:40px}.chat-toolbar button{min-height:40px}.chat-actions button{min-height:40px}}
@media(max-height:520px){.desk-chat>#desk-chat-context{display:none}.chat-toolbar{padding:4px 10px}.chat-analysis:not([open]){padding:4px 12px}.chat-form textarea{min-height:40px;max-height:60px}.chat-source-settings{max-height:80px}}

.chat-starters{display:flex;flex:none;gap:6px;flex-wrap:wrap;padding:6px 14px}.chat-starters button{font-size:12px;min-height:32px;padding:6px 10px;border-radius:16px;background:var(--desk-bg);color:var(--blue)}
