/* The same conversation is the main workspace on #agent and an optional Lab assistant. */
.agent-chat-prompts,.agent-chat-capability-note { display:none; }
#app-shell.agent-chat-main { grid-template-columns:var(--sidebar) var(--agent-rail) minmax(0,1fr); }
#app-shell.agent-chat-main .main-area { min-height:0; grid-template-rows:var(--topbar) minmax(0,1fr); }
#app-shell.agent-chat-main #view-agent { display:flex; min-width:0; min-height:0; overflow:hidden; padding:0; }
#agent-chat-host { display:flex; flex:1; min-width:0; min-height:0; height:100%; }
/* The top-bar Agent control remains available on the full chat page. */
html:root #app-shell.agent-chat-main #sog-agent-panel {
  display:grid; position:relative; inset:auto; width:100%; max-width:none; min-height:0; height:100%;
  grid-template-columns:minmax(0,1fr); grid-template-rows:56px minmax(0,1fr) auto auto;
  grid-template-areas:"head" "thread" "jump" "composer";
  border:0; box-shadow:none; background:var(--surface-0); color:var(--text-1); z-index:auto;
  opacity:1; visibility:visible; transform:none; pointer-events:auto; transition:none;
}
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-header { height:56px; padding:0 28px; background:transparent; border:0; backdrop-filter:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-title strong { font-size:15px; font-weight:600; color:var(--text-2); }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-title :is(.agent-panel-logo,small) { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel :is(#agent-open-home,#agent-close) { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-tools { gap:8px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-tools :is(#agent-new-chat,#agent-history-toggle) { display:flex; width:auto; height:36px; align-items:center; gap:7px; padding:7px 10px; font:500 14px/20px var(--font-ui); border:1px solid transparent; color:var(--text-2); }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-new-chat::after { content:"New chat"; }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-history-toggle::after { content:"History"; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-tools button:hover { background:var(--surface-2); color:var(--text-1); }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-thread { padding:28px 32px 36px; background:transparent; min-height:0; }
html:root #app-shell.agent-chat-main #sog-agent-panel[data-chat-empty="true"] .agent-thread { display:grid; place-items:center; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-welcome { width:min(800px,100%); padding:12px 0 44px; margin:0 auto; text-align:center; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-welcome :is(.agent-welcome-orbit,.eyebrow),
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-welcome > p:not(.agent-chat-capability-note),
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-starters { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-chat-title { margin:0; color:var(--text-1); font:550 clamp(28px,2.7vw,42px)/1.2 var(--font-ui); letter-spacing:-.035em; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-capability-note:not([hidden]) { display:block; max-width:600px; margin:18px auto 0; color:var(--text-2); font-size:14px; line-height:1.6; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin-top:36px; text-align:left; }
.agent-chat-prompt { display:flex; flex-direction:column; align-items:flex-start; gap:20px; min-width:0; min-height:166px; padding:22px; border:1px solid var(--hairline-strong); border-radius:14px; background:var(--surface-1); color:var(--text-1); text-align:left; cursor:pointer; font:500 15px/1.6 var(--font-ui); transition:background 140ms,border-color 140ms; }
.agent-chat-prompt:hover { background:var(--surface-2); border-color:var(--text-3); }
.agent-chat-prompt>.icon { width:20px; height:20px; color:var(--text-2); }
.agent-chat-prompt .agent-prompt-arrow { width:16px; height:16px; align-self:flex-end; margin-top:auto; transform:rotate(45deg); }
.agent-chat-prompt:focus-visible { outline:2px solid var(--gold); outline-offset:3px; }
html:root #app-shell.agent-chat-main #sog-agent-panel[data-chat-empty="true"] #agent-messages:empty { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-messages { width:min(800px,100%); margin:0 auto; gap:32px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message { gap:16px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message-body,
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message-body>p { color:var(--text-1); font-size:16px; line-height:1.8; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message.user { display:flex; justify-content:flex-end; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message.user .agent-message-avatar { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-message.user .agent-message-body { max-width:85%; padding:14px 20px; border-radius:20px 20px 5px 20px; background:var(--surface-2); }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-answer-meta { font-size:13px; line-height:1.5; margin-bottom:9px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer { justify-self:center; width:min(800px,calc(100% - 64px)); margin:0 0 24px; padding:6px; border:1px solid var(--hairline-strong); border-radius:20px; background:var(--surface-1); box-shadow:0 5px 28px #0000000c; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer > div:has(> #agent-input) { display:flex; flex-wrap:wrap; gap:6px; align-items:center; padding:12px; }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-input { order:-1; flex:1 0 100%; width:100%; min-height:58px; max-height:180px; resize:none; padding:0 2px 10px; color:var(--text-1); background:transparent; font:400 16px/1.6 var(--font-ui); }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-input::placeholder { color:var(--text-3); }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer :is(.agent-context-button,.sog-attach-button,.sog-voice-mic,.agent-send) { display:grid; place-items:center; flex:none; width:36px; height:36px; border-radius:9px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer .agent-send { margin-left:auto; background:var(--text-1); color:var(--surface-0); }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer .agent-send:disabled { opacity:.45; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer footer { padding:4px 12px 8px; color:var(--text-3); font-size:13px; line-height:1.5; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer :is(.recipe-agent-bar,.agent-project-document-row) > button { font-size:14px; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-history { margin:0 24px; border:1px solid var(--hairline); border-radius:12px; }
html:root #app-shell.agent-chat-main #sog-agent-panel.has-history-open .agent-thread { visibility:hidden; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-jump-latest { font-size:14px; padding:7px 12px; }
@media(max-width:1100px) and (min-width:761px) {
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompts { grid-template-columns:1fr; gap:8px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompt { flex-direction:row; align-items:center; min-height:65px; padding:14px; gap:14px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-prompt-arrow { align-self:center; margin:0 0 0 auto; flex:none; }
}
@media(max-width:760px) {
  #app-shell.agent-chat-main { display:flex; }
  html:root #app-shell.agent-chat-main #sog-agent-panel { grid-template-rows:48px minmax(0,1fr) auto auto; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-header { height:48px; padding:0 14px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-title strong { font-size:14px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-tools { gap:2px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-tools :is(#agent-new-chat,#agent-history-toggle) { padding:7px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel #agent-history-toggle::after { content:none; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-thread { padding:20px 18px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-welcome { padding:12px 0; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompts { grid-template-columns:1fr; gap:8px; margin-top:24px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompt { min-height:60px; flex-direction:row; align-items:center; padding:12px 14px; gap:12px; font-size:14px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-chat-prompt>.icon { flex:none; width:17px; height:17px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-prompt-arrow { align-self:center; margin:0 0 0 auto; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer { width:calc(100% - 24px); margin-bottom:max(12px,env(safe-area-inset-bottom)); border-radius:16px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer > div:has(> #agent-input) { padding:8px; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-history { margin:0 12px; }
}

/* A compact assistant floats above workbenches without taking a layout column. */
html:root #app-shell.agent-panel-open:not(.agent-chat-main) { grid-template-columns:var(--sidebar) var(--agent-rail) minmax(0,1fr); }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel {
  position:fixed; inset:auto 20px 20px auto; width:400px; max-width:calc(100vw - 24px); height:min(700px,calc(100dvh - 90px));
  border:1px solid var(--hairline-strong); border-radius:18px; overflow:hidden; box-shadow:0 20px 70px #0005; z-index:80;
}
#agent-chat-float { position:fixed; right:20px; bottom:20px; width:400px; max-width:calc(100vw - 24px); height:min(700px,calc(100dvh - 90px)); display:grid; grid-template-rows:60px minmax(0,1fr) auto; border:1px solid var(--hairline-strong); border-radius:18px; overflow:hidden; box-shadow:0 20px 70px #0005; z-index:85; background:var(--surface-1); color:var(--text-1); font:400 15px/1.65 var(--font-ui); }
#agent-chat-float[hidden],#agent-artifacts[hidden],#agent-artifacts [hidden] { display:none!important; }
#agent-chat-float>header,#agent-artifacts>header { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:12px 16px; border-bottom:1px solid var(--hairline); }
#agent-chat-float>header strong { font-size:15px; font-weight:600; }
#agent-chat-float button,#agent-artifacts button { color:inherit; border:0; background:transparent; cursor:pointer; font:inherit; }
.agent-float-tools { display:flex; gap:2px; }
.agent-float-tools button,#agent-artifacts>header button { display:grid; place-items:center; width:34px; height:34px; border-radius:7px; }
.agent-float-tools button:hover,#agent-artifacts button:hover { background:var(--surface-3); }
#agent-chat-float .icon,#agent-artifacts .icon { width:18px; height:18px; flex:none; }
.agent-float-thread { overflow:auto; min-height:0; padding:20px; overscroll-behavior:contain; }
.agent-float-welcome { display:grid; align-content:center; gap:10px; min-height:100%; }
.agent-float-welcome h2 { font-size:25px; line-height:1.3; font-weight:550; text-align:center; margin:0 0 22px; }
#agent-chat-float .agent-float-welcome button { border:1px solid var(--hairline-strong); padding:12px 14px; text-align:left; border-radius:10px; }
.agent-float-message { margin:0 0 24px; overflow-wrap:anywhere; }
.agent-float-message p { white-space:pre-wrap; margin:0; }
.agent-float-message.user { margin-left:24px; padding:12px 16px; border-radius:16px 16px 4px 16px; background:var(--surface-3); }
#agent-chat-float .agent-float-details { padding:6px 0 0; font-size:13px; color:var(--text-2); text-decoration:underline; text-underline-offset:3px; }
.agent-float-pending { color:var(--text-2); }
#agent-chat-float form { padding:12px; margin:12px; margin-top:0; border:1px solid var(--hairline-strong); border-radius:14px; }
#agent-chat-float textarea { display:block; resize:none; width:100%; max-height:150px; border:0; outline:0; background:transparent; color:var(--text-1); font:400 15px/1.6 var(--font-ui); }
#agent-chat-float form:focus-within { border-color:var(--text-3); }
#agent-chat-float form>div { display:flex; justify-content:space-between; margin-top:10px; }
#agent-chat-float form button { display:grid; place-items:center; width:36px; height:36px; border-radius:8px; }
#agent-chat-float .agent-float-send { background:var(--text-1); color:var(--surface-0); }
#agent-chat-float .agent-float-send:disabled { opacity:.4; cursor:wait; }
#agent-chat-float button:focus-visible,#agent-artifacts button:focus-visible,#agent-artifacts a:focus-visible { outline:2px solid var(--gold); outline-offset:2px; }
html:root #app-shell:not(.agent-chat-main) #agent-artifacts-toggle { display:none; }
html:root #app-shell.agent-chat-main #agent-artifacts-toggle { display:flex; align-items:center; gap:7px; padding:7px 10px; width:auto; height:36px; color:var(--text-2); font:500 14px/20px var(--font-ui); }
#agent-artifacts-toggle .agent-artifact-count:empty { display:none; }
#agent-artifacts { flex:0 0 420px; min-width:0; display:flex; flex-direction:column; height:100%; border-left:1px solid var(--hairline); background:var(--surface-1); overflow:hidden; }
#agent-artifacts>header { height:56px; flex:none; }
.agent-artifact-list { padding:14px; overflow:auto; }
#agent-artifacts .agent-artifact-entry { display:flex; align-items:center; gap:12px; padding:14px 10px; width:100%; border:1px solid var(--hairline); border-radius:10px; margin-bottom:10px; font-size:15px; text-align:left; }
.agent-artifact-entry span { flex:1; overflow-wrap:anywhere; }
.agent-artifact-preview { display:flex; flex-direction:column; min-height:0; flex:1; }
.agent-artifact-toolbar { display:flex; align-items:center; justify-content:space-between; padding:10px 16px; gap:12px; }
#agent-artifacts .agent-artifact-toolbar button { display:flex; align-items:center; gap:6px; padding:6px 0; }
.agent-artifact-toolbar a { font-size:14px; color:var(--text-1); }
.agent-artifact-preview h3 { padding:0 16px; font-size:15px; font-weight:600; overflow-wrap:anywhere; }
.agent-artifact-preview iframe { width:100%; flex:1; border:0; background:var(--surface-0); }
.agent-artifact-preview pre { overflow:auto; flex:1; margin:0; padding:20px; font:13px/1.7 var(--font-mono,monospace); white-space:pre-wrap; overflow-wrap:anywhere; color:var(--text-1); background:var(--surface-0); }
.agent-artifact-empty { color:var(--text-2); font-size:15px; line-height:1.65; margin:24px 16px; }
html:root #app-shell.artifacts-open #sog-agent-panel { flex:1; width:0; }
html:root #app-shell.artifacts-open #sog-agent-panel .agent-chat-prompts { grid-template-columns:1fr; }
html:root #app-shell.artifacts-open #sog-agent-panel .agent-chat-prompt { min-height:70px; flex-direction:row; padding:14px; }
@media(max-width:1350px) { #app-shell.artifacts-open #agent-artifacts { position:absolute; right:0; top:var(--topbar); bottom:0; width:min(460px,calc(100% - var(--sidebar) - var(--agent-rail))); height:auto; z-index:40; box-shadow:-12px 0 40px #0002; } html:root #app-shell.artifacts-open #sog-agent-panel { width:100%; } }
@media(max-width:760px) {
  #agent-chat-float,html:root #app-shell:not(.agent-chat-main) #sog-agent-panel { right:12px; bottom:12px; height:calc(100dvh - 84px); border-radius:16px; }
  #app-shell.artifacts-open #agent-artifacts { position:fixed; top:64px; right:0; bottom:0; width:100%; }
  html:root #app-shell.agent-chat-main #agent-artifacts-toggle { padding:7px; }
  html:root #app-shell.agent-chat-main #agent-artifacts-toggle>span:not(.agent-artifact-count) { display:none; }
}

/* Existing assistant transitions must not hide the embedded conversation. */
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-header { flex-wrap:nowrap; }
html:root #app-shell.agent-chat-main #sog-agent-panel #agent-footer-runtime { display:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel .agent-composer footer { justify-content:flex-end; }
html:root #app-shell.agent-panel-open:not(.agent-chat-main) #sog-agent-panel { opacity:1; transform:none; visibility:visible; pointer-events:auto; display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:60px minmax(0,1fr) auto auto; grid-template-areas:"head" "thread" "jump" "composer"; background:var(--surface-1); }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-header { padding:12px 16px; height:60px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-title strong { font-size:15px; line-height:20px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-title :is(.agent-panel-logo,small),
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel #agent-footer-runtime { display:none; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-tools { gap:2px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-tools button { width:32px; height:34px; padding:7px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-thread { padding:20px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel[data-chat-empty="true"] .agent-thread { display:grid; place-items:center; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-welcome { padding:16px 0; text-align:center; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-welcome :is(.agent-welcome-orbit,.eyebrow),
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-welcome>p,
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel #agent-starters { display:none; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel #agent-chat-title { font-size:25px; line-height:1.3; margin:0 0 22px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-chat-prompts { display:grid; gap:10px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-chat-prompt { display:block; min-height:0; padding:12px 14px; font-size:15px; line-height:1.65; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-chat-prompt>.icon { display:none; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer { margin:0 12px 12px; padding:10px; width:auto; border:1px solid var(--hairline-strong); border-radius:14px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer>div:has(>#agent-input) { display:flex; flex-wrap:wrap; gap:7px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel #agent-input { flex:1 0 100%; order:-1; min-height:64px; padding:2px; font-size:15px; line-height:1.6; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer .agent-send { margin-left:auto; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer footer { font-size:13px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer :is(.recipe-agent-bar,.agent-project-document-row)>button { font-size:14px; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel.has-history-open .agent-thread { visibility:hidden; }
@media(max-width:760px) {
  html:root #app-shell.agent-chat-main .main-area { grid-template-rows:104px minmax(0,1fr); }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-title strong { max-width:125px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}

html:root #app-shell.agent-chat-main #sog-agent-panel { translate:none; }
html:root #app-shell.agent-chat-main #sog-agent-panel :is(#agent-close,#agent-open-home),
html:root #app-shell:not(.agent-chat-main) #agent-artifacts-toggle { display:none!important; }
html:root #sog-agent-panel .agent-composer footer>span:first-child { display:none; }
html:root #sog-agent-panel .agent-composer footer>span:last-child { display:flex; font:400 13px/1.5 var(--font-ui); }
html:root #sog-agent-panel .agent-composer #agent-input:focus { outline:0!important; box-shadow:none; }
html:root #sog-agent-panel .agent-composer:focus-within { border-color:var(--gold); }
html:root #app-shell.agent-panel-open:not(.agent-chat-main) #sog-agent-panel { translate:none; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-title { min-width:0; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-title strong { white-space:nowrap; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-panel-tools { flex:none; }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-composer { background:var(--surface-1); }
html:root #app-shell:not(.agent-chat-main) #sog-agent-panel .agent-chat-prompt { font-weight:400; }
@media(max-width:760px) {
  html:root #app-shell.agent-chat-main #sog-agent-panel #agent-new-chat::after { content:none; }
  html:root #app-shell.agent-chat-main #agent-artifacts-toggle { width:36px; }
  html:root #app-shell.agent-chat-main #agent-artifacts-toggle>span:not(.agent-artifact-count) { display:none!important; }
  html:root #app-shell.agent-chat-main #sog-agent-panel .agent-panel-title strong { max-width:170px; }
}

.agent-float-capability-note { margin:0 0 10px; font-size:14px; line-height:1.6; color:var(--text-2); }
html[data-theme="light"] #app-shell.agent-chat-main #sog-agent-panel { background:#fafafa; }
