/* Conversation structure follows the upstream demo: header, scrolling chat, composer. */
.sidebar-robot{position:relative;display:flex;justify-content:center;min-width:0;margin-top:auto;flex-shrink:0}
#themeToggleButton{margin-top:9px;flex-shrink:0}
.sidebar-robot-trigger{--robot-size:112px;box-sizing:border-box;display:grid;place-items:center;width:128px;min-height:128px;margin:0;padding:8px;border:0;border-radius:22px;background:transparent;color:var(--text);box-shadow:none;cursor:pointer;flex-shrink:0}
.sidebar-robot-trigger:hover{background:transparent}
.sidebar-robot-trigger agent-robot-avatar{display:block;width:var(--robot-size);height:var(--robot-size);filter:drop-shadow(0 8px 12px rgba(98,193,62,.12))}
.sidebar-robot-trigger:focus-visible,.ai-robot-panel button:focus-visible,.sidebar-robot-speech button:focus-visible{outline:3px solid var(--primary);outline-offset:3px}
.ai-robot-panel[hidden],.ai-robot-panel [hidden],.sidebar-robot-speech[hidden]{display:none!important}
.ai-robot-panel,.sidebar-robot-speech{position:fixed;z-index:120;box-sizing:border-box;border:1px solid var(--line);background:var(--panel);color:var(--text);box-shadow:0 16px 48px rgba(23,58,36,.14);isolation:isolate;transform-origin:left bottom;animation:ai-robot-panel-in .28s cubic-bezier(.16,1,.3,1);font-family:inherit}
.ai-robot-panel::after,.sidebar-robot-speech::after{content:'';position:absolute;left:-7px;top:calc(var(--robot-tail-y,50%) - 6px);width:12px;height:12px;transform:rotate(45deg);border-left:1px solid var(--line);border-bottom:1px solid var(--line);background:var(--panel);z-index:-1}
.ai-robot-panel[data-placement=above]::after,.sidebar-robot-speech[data-placement=above]::after{left:calc(var(--robot-tail-x,50%) - 6px);top:auto;bottom:-7px;border-left:0;border-right:1px solid var(--line);border-bottom:1px solid var(--line)}
.sidebar-robot-speech{display:flex;align-items:flex-start;gap:12px;border-radius:18px;padding:14px 16px;font-size:14px;line-height:1.65}
.sidebar-robot-speech span{min-width:0;overflow-wrap:anywhere;flex:1}
.sidebar-robot-speech button{display:grid;place-items:center;flex:0 0 24px;width:24px;height:24px;padding:0;border:0;border-radius:8px;background:var(--panel-soft);color:var(--muted)}
.sidebar-robot-speech .ui-icon{width:15px;height:15px}
.ai-robot-speech-body{flex:1;min-width:0}
.sidebar-robot-speech #aiRobotSpeechText{display:block;width:100%;height:auto;padding:0;background:transparent;color:var(--text);font:inherit;text-align:left;white-space:normal;overflow-wrap:anywhere}
#aiRobotSpeechOptions[hidden]{display:none!important}
#aiRobotSpeechOptions{display:flex;gap:12px;margin-top:8px}
.sidebar-robot-speech #aiRobotSpeechOptions button{display:block;flex:0 1 auto;width:auto;height:auto;padding:2px 0;background:transparent;color:var(--muted);font:inherit;font-size:11px;white-space:nowrap}
.ai-robot-companion-settings{box-sizing:border-box;width:min(460px,calc(100vw - 28px));max-height:calc(100dvh - 28px);overflow:auto;padding:22px;border:1px solid var(--line);border-radius:20px;color:var(--text);background:var(--panel);font-family:inherit;font-size:14px;line-height:1.6;box-shadow:var(--shadow)}
.ai-robot-companion-settings::backdrop{background:rgba(16,25,22,.4);backdrop-filter:blur(3px)}
.companion-settings-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.companion-settings-head h2{margin:0;font-size:18px}.companion-settings-head button{padding:0 8px;border:0;border-radius:8px;background:var(--panel-soft);color:var(--muted);font-size:24px}
.ai-robot-companion-settings p{margin:12px 0;color:var(--muted);font-size:13px}.ai-robot-companion-settings label{display:block;font-size:13px}.ai-robot-companion-settings select,.ai-robot-companion-settings input[type=time]{box-sizing:border-box;width:100%;min-width:0;margin:5px 0 0;padding:9px 8px;border:1px solid var(--line);border-radius:9px;background:var(--panel-soft);color:var(--text);font:inherit;font-size:14px}
.companion-times{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:16px 0}.ai-robot-companion-settings fieldset{margin:12px 0;padding:10px;border:1px solid var(--line);border-radius:10px}.ai-robot-companion-settings legend{padding:0 5px;font-size:13px}.companion-days{display:flex;justify-content:space-between;gap:4px}.companion-days label{display:flex;align-items:center;gap:3px}
.ai-robot-companion-settings input[type=checkbox]{width:15px;min-width:15px;height:15px;margin:0;accent-color:var(--primary)}.ai-robot-companion-settings .companion-ai-choice{display:flex;align-items:center;gap:8px;margin:16px 0 8px}.ai-robot-companion-settings small{display:block;color:var(--muted);font-size:11px;line-height:1.8}.companion-settings-actions{display:flex;justify-content:flex-end;align-items:center;gap:12px;margin-top:16px}.companion-settings-actions>button:not(.ai-robot-send){border:0;background:transparent;color:var(--primary-dark);font:inherit;font-size:12px}
@media(max-width:380px){.ai-robot-companion-settings{padding:16px}.companion-times{gap:6px}.companion-days label{flex-direction:column;gap:5px}}
.ai-robot-panel{display:flex;border-radius:26px;outline:0}
.ai-robot-panel-surface{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;height:100%;overflow:hidden;border-radius:inherit;background:var(--panel)}
.ai-robot-panel-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 20px;border-bottom:1px solid var(--line);flex-shrink:0}
.ai-robot-panel-head>div{min-width:0}
.ai-robot-panel-head h2{margin:0;font-size:18px;font-weight:700;line-height:1.45;white-space:normal;overflow-wrap:anywhere}
.ai-robot-panel-head p{margin:4px 0 0;font-size:13px;line-height:1.5;color:var(--muted)}
.ai-robot-panel-close{display:grid;place-items:center;flex:0 0 34px;width:34px;height:34px;padding:0;border:0;border-radius:11px;background:var(--panel-soft);color:var(--muted);font-size:22px;cursor:pointer}
.ai-robot-panel-close:hover{color:var(--text);background:var(--primary-pale)}
.ai-robot-conversation{display:flex;flex-direction:column;gap:14px;flex:1;min-height:64px;min-width:0;overflow:auto;overscroll-behavior:contain;padding:20px;scrollbar-width:thin}
.ai-robot-chat-bubble{align-self:flex-start;flex-shrink:0;box-sizing:border-box;max-width:86%;margin:0;padding:12px 14px;border-radius:18px 18px 18px 7px;background:var(--panel-soft);color:var(--text);font-size:14px;line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;animation:ai-robot-message-in .2s ease-out}
.ai-robot-chat-user{align-self:flex-end;border-radius:18px 18px 7px 18px;background:var(--primary-pale)}
.ai-robot-chat-status{color:var(--text)}
.ai-robot-chat-bubble>p{margin:0;font:inherit;color:inherit}
.ai-robot-chat-bubble details{margin-top:8px;font-size:13px}
.ai-robot-chat-bubble details p{white-space:pre-wrap;overflow-wrap:anywhere}
.ai-robot-reply-meta{display:block;margin-top:8px;color:var(--muted);font-size:12px}
.ai-robot-shortcuts{display:flex;flex-wrap:wrap;gap:8px;flex-shrink:0}
.ai-robot-shortcuts button{padding:8px 10px;border-radius:12px;color:var(--primary-dark);background:var(--primary-pale);font:inherit;font-size:13px;text-align:left;white-space:normal}
.ai-robot-attachment{display:flex;gap:8px;align-items:center;justify-content:space-between;color:var(--muted);font-size:13px;min-width:0}
.ai-robot-compose-hint{font-size:13px;color:var(--muted)}
#aiRobotTitleField{display:grid;gap:8px;flex-shrink:0;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--panel-soft)}
#aiRobotTitleField .ai-robot-tool-label{flex-wrap:wrap}
.ai-robot-connection{display:grid;gap:8px;flex-shrink:0;padding:12px;border:1px solid var(--line);border-radius:14px;background:var(--panel-soft);font-size:13px;line-height:1.6}
.ai-robot-connection p{margin:0}.ai-robot-connection small{color:var(--muted)}
.ai-robot-panel #aiRobotApiKey{box-sizing:border-box;width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text);font:inherit;font-size:16px}
.sidebar-robot-speech span{cursor:pointer}
.ai-robot-conversation[data-state=waiting] .ai-robot-chat-status::after{content:'\2022  \2022  \2022';display:block;font-size:10px;letter-spacing:3px;animation:ai-robot-wait 1s ease-in-out infinite}
.ai-robot-composer-wrap{display:grid;gap:10px;flex-shrink:0;min-width:0;margin:0;padding:10px 14px 12px;border-top:1px solid var(--line)}
.ai-robot-context-row{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;flex-wrap:wrap}
.ai-robot-tool-label{display:flex;align-items:center;gap:8px;min-width:0;margin:0;color:var(--muted);font-size:13px;line-height:1.5}
.ai-robot-panel .ai-robot-tool-label select{box-sizing:border-box;width:144px;max-width:100%;min-width:0;margin:0;padding:5px 8px;border:0;border-radius:8px;background:var(--panel-soft);color:var(--text);font:inherit}
.ai-robot-input-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.ai-robot-composer{display:grid;gap:8px;min-width:0;margin:0;padding:12px;border:1px solid var(--line);border-radius:20px;background:var(--panel);box-shadow:0 4px 16px rgba(0,0,0,.025)}
.ai-robot-composer:focus-within{border-color:var(--primary)}
.ai-robot-panel .ai-robot-composer textarea,.ai-robot-panel #aiRobotFeedbackTitle{box-sizing:border-box;display:block;width:100%;min-width:0;min-height:0;margin:0;padding:0;border:0;border-radius:0;background:transparent;color:var(--text);font:inherit;font-size:16px;line-height:1.6;box-shadow:none;outline:0}
.ai-robot-panel .ai-robot-composer textarea{height:72px;resize:none}
.ai-robot-panel #aiRobotFeedbackTitle{border:1px solid var(--line);border-radius:8px;padding:6px 8px}
.ai-robot-composer textarea::placeholder,.ai-robot-panel #aiRobotFeedbackTitle::placeholder{color:var(--muted)}
.ai-robot-composer-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}
.ai-robot-text-button{padding:4px 0;border:0;background:transparent;color:var(--muted);font:inherit;font-size:13px;line-height:1.5;cursor:pointer}
.ai-robot-text-button:hover{color:var(--primary)}
.ai-robot-send{display:flex;align-items:center;gap:8px;padding:8px 14px;border:0;border-radius:11px;background:var(--primary);color:#fff;font:inherit;font-size:14px;font-weight:600;cursor:pointer}
.ai-robot-send:disabled{opacity:.55;cursor:wait}
@keyframes ai-robot-panel-in{from{opacity:0;transform:translate(-4px,6px) scale(.985)}to{opacity:1;transform:translate(0,0) scale(1)}}
@keyframes ai-robot-message-in{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
@keyframes ai-robot-wait{50%{opacity:.35}}
@media(min-width:681px){.sidebar .side-nav{min-height:0;overflow-y:auto}.sidebar .brand{flex-shrink:0}.sidebar #logoutButton{flex-shrink:0}}
@media(max-width:680px){.sidebar-robot{width:100%;margin:12px 0 0}.sidebar-robot-trigger{--robot-size:96px;width:112px;min-height:112px}.ai-robot-panel-head{padding:14px 18px}.ai-robot-conversation{padding:16px 18px}.ai-robot-panel .ai-robot-tool-label select{font-size:16px}.image-workbench-active .sidebar{max-height:none;overflow:visible}}
@media(max-height:560px){.ai-robot-panel-head{padding:10px 16px}.ai-robot-panel-head p{display:none}.ai-robot-composer-wrap{padding:10px 14px}.ai-robot-panel .ai-robot-composer textarea{height:54px}}
@media(prefers-reduced-motion:reduce){.sidebar-robot-trigger,.sidebar-robot-trigger agent-robot-avatar,.sidebar-robot-speech,.ai-robot-panel,.ai-robot-chat-bubble,.ai-robot-chat-status::after{transition:none!important;animation:none!important}}
