/* Isolated result styles: answer typography must never squeeze usage or actions. */
#shell .result-stats-card.b1x-usage-card {
  display:grid!important;grid-template-columns:repeat(auto-fit,minmax(min(155px,100%),1fr))!important;
  gap:16px!important;align-items:start!important;width:auto!important;max-width:100%!important;
  padding:16px!important;margin:20px 0 12px!important;border:1px solid var(--b1x-border,#9ca9a2)!important;
  border-radius:12px!important;background:var(--b1x-control,#f3f6f5)!important;box-shadow:none!important;
  font:13px/1.5 var(--font-ui,system-ui)!important;color:var(--b1x-text,inherit)!important;
}
#shell .b1x-usage-card .usage-heading {grid-column:1/-1;margin:0;font-size:12px;font-weight:650}
#shell .b1x-usage-card .usage-metric {min-width:0;display:block}
#shell .b1x-usage-card .usage-label {display:block;font-size:11px;color:var(--b1x-muted);margin-bottom:4px}
#shell .b1x-usage-card .usage-value {display:block!important;font:600 14px/1.5 var(--font-ui,system-ui)!important;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important}
#shell .b1x-usage-card .usage-value[data-numeric] {white-space:nowrap!important;font-variant-numeric:tabular-nums}
#shell .b1x-usage-card .usage-note {display:block!important;margin-top:3px;font:400 11px/1.5 var(--font-ui,system-ui)!important;color:var(--b1x-muted);white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important}
/* Primary exports remain discoverable, including on restored/collapsed answers. */
@media screen {
  #shell#shell#shell#shell#shell#shell#shell .response-actions-toolbar.chat-answer-actions {
    display:flex!important;visibility:visible!important;opacity:1!important;position:relative!important;
    flex-wrap:wrap!important;align-items:center!important;gap:8px!important;overflow:visible!important;
    width:auto!important;max-width:100%!important;height:auto!important;min-height:40px!important;
    padding:8px 0!important;margin:0 0 16px!important;z-index:auto!important;
  }
  #shell#shell#shell#shell#shell#shell#shell .chat-answer-actions>.response-btn {
    display:inline-flex!important;align-items:center!important;gap:6px!important;min-height:36px!important;
    width:auto!important;padding:7px 11px!important;border:1px solid var(--b1x-border)!important;border-radius:8px!important;
    color:var(--b1x-text)!important;background:var(--b1x-control)!important;font:500 12px/1.4 var(--font-ui,system-ui)!important;
  }
  #shell#shell#shell#shell#shell#shell#shell .chat-answer-actions>.response-btn>span {display:inline!important}
}
.chat-media-actions {display:flex;gap:10px;align-items:center;margin:12px 0;flex-wrap:wrap;font:12px/1.5 system-ui}
.chat-media-actions button {padding:8px 12px;border:1px solid var(--b1x-border);border-radius:8px;background:var(--b1x-control);color:var(--b1x-text)}
dialog.chat-media-gallery {width:min(1180px,94vw);max-width:94vw;height:90dvh;max-height:90dvh;padding:0;border:1px solid var(--b1x-border);border-radius:14px;background:var(--b1x-solid,#fff);color:var(--b1x-text,#182520);overflow:hidden}
.chat-media-gallery::backdrop {background:rgb(0 0 0 / .65)}
.chat-media-gallery[open] {display:flex;flex-direction:column}
.chat-media-gallery-bar {display:flex;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--b1x-border);flex:none}
.chat-media-gallery-bar strong {flex:1;font:600 15px/1.5 system-ui}
.chat-media-gallery button {font:500 13px/1.4 system-ui;min-height:36px;padding:7px 12px;border:1px solid var(--b1x-border);border-radius:8px;background:var(--b1x-control);color:var(--b1x-text)}
.chat-media-gallery-stage {flex:1;min-height:0;overflow:auto;padding:12px}
.chat-media-gallery-stage .artifact-viewer {height:100%;box-sizing:border-box}
.chat-media-gallery-stage :is(video,img) {max-height:53dvh;object-fit:contain}
.chat-media-gallery-list {display:flex;gap:8px;padding:10px 16px;border-top:1px solid var(--b1x-border);overflow-x:auto;flex:none}
.chat-media-gallery-list button {flex:0 0 130px;max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
.chat-media-gallery-list button[aria-current=true] {outline:2px solid var(--b1x-accent,#6c4da8);outline-offset:-2px}
.chat-media-gallery-list img {width:32px;height:24px;object-fit:cover;margin-right:6px;vertical-align:middle}
@media(max-width:600px){.chat-media-gallery-bar{gap:6px;padding:10px}.chat-media-gallery-bar strong{font-size:13px}.chat-media-gallery-bar button{padding:7px}.chat-media-gallery-stage{padding:6px}}
@media print{.chat-media-actions,.chat-media-gallery,.b1x-usage-card{display:none!important}}

/* Keep the conversation dock shallow; expanded and manually sized drafts keep
   their existing sizing. The latest-output shortcut shares the Activity row. */
@media screen {
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat]:not(.launch-empty):not(.dock-open) #main > .composer-area {
  padding:4px 16px max(4px,env(safe-area-inset-bottom,0px))!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > .live-execution {
  margin:0 auto 4px!important;padding:0!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > .live-execution > summary {
  min-height:32px!important;height:32px!important;padding:0 8px!important;box-sizing:border-box!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area:has(> .live-execution:not([hidden])) > .calm-latest:not([hidden]) {
  position:absolute!important;top:5px!important;left:50%!important;right:auto!important;transform:translateX(-50%)!important;
  margin:0!important;min-height:30px!important;height:30px!important;padding:3px 10px!important;font-size:11px!important;z-index:2;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not([data-manual-size=true]) {
  gap:2px!important;padding:4px 6px!important;margin-block:0!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not([data-manual-size=true]) #prompt {
  min-height:32px!important;padding-block:4px!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not([data-manual-size=true]) #prompt:placeholder-shown:not(:focus) {
  height:32px!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > .workspace-legal-footer {
  min-height:24px!important;margin:0 auto!important;padding:0!important;
 }
 :root[data-theme] body #shell#shell#shell#shell#shell#shell#shell#shell[data-view-mode=chat] #main > .composer-area > .workspace-legal-footer > :is(a,button) {
  min-height:24px!important;height:24px!important;padding-block:0!important;
 }
}

/* A short draft shares the control row when there is enough horizontal room.
   Flex wrapping provides a fallback for side panels and narrow viewports. */
@layer composer-refinement {
 @media screen and (max-width:799px) {
  #shell#shell[data-view-mode=chat] #main > .composer-area {
   padding:3px 8px max(3px,env(safe-area-inset-bottom,0px))!important;
  }
  #shell#shell[data-view-mode=chat] #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) {
   display:flex!important;flex-flow:column nowrap!important;align-items:stretch!important;
   width:100%!important;max-width:100%!important;min-height:0!important;height:auto!important;
   gap:2px!important;padding:4px 6px!important;margin-block:0!important;
  }
  #shell#shell[data-view-mode=chat] #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) #prompt {
   flex:none!important;width:100%!important;min-width:0!important;height:34px!important;min-height:34px!important;max-height:34px!important;
   margin:0!important;padding:5px 4px!important;font-size:16px!important;line-height:24px!important;overflow-y:auto!important;
  }
  #shell#shell[data-view-mode=chat] #composer .composer-toolbar {
   display:flex!important;flex-flow:row nowrap!important;align-items:center!important;
   width:100%!important;min-width:0!important;flex:none!important;gap:2px!important;padding:0!important;margin:0!important;min-height:44px!important;
  }
  #shell#shell[data-view-mode=chat] #composer .composer-toolbar > .composer-model-control {
   flex:1 1 80px!important;min-width:0!important;width:auto!important;max-width:none!important;margin:0!important;
  }
  #shell#shell[data-view-mode=chat] #composer .composer-model-control .model-menu-trigger {
   width:100%!important;min-width:0!important;max-width:100%!important;overflow:hidden!important;
  }
  #shell#shell[data-view-mode=chat] #composer .composer-toolbar > .calm-tools > summary {
   width:44px!important;min-width:44px!important;min-height:44px!important;padding:0 4px!important;font-size:11px!important;display:flex!important;align-items:center!important;justify-content:center!important;
  }
  #shell#shell[data-view-mode=chat] #composer .composer-toolbar > :is(#composer-size-toggle,#send,#stop),
  #shell#shell[data-view-mode=chat] #composer .composer-toolbar > .plugin-anchor > button {
   flex:0 0 40px!important;width:40px!important;min-width:40px!important;min-height:44px!important;height:44px!important;padding:4px!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area:has(> #composer:not(.expanded):not(.shared-composer-expanded)) > :is(.b1x-live-chips,.disclaimer) {display:none!important}
  #shell#shell[data-view-mode=chat] .calm-mobile-options:not([hidden]) {display:flex!important;flex-direction:column!important;gap:4px!important;padding-bottom:8px!important;margin-bottom:8px!important;border-bottom:1px solid var(--b1x-border)}
  #shell#shell[data-view-mode=chat] .calm-mobile-option {display:flex!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;min-height:44px!important;font:13px/1.4 var(--sans,system-ui)}
  #shell#shell[data-view-mode=chat] #composer .calm-mobile-option > button {position:static!important;width:52px!important;min-width:44px!important;max-width:100%!important;min-height:44px!important;height:44px!important;flex:none!important;margin:0!important;padding:4px!important}
  #shell#shell[data-view-mode=chat] #composer .calm-mobile-option > #ascendant-route-label {display:flex!important;align-items:center!important;min-height:44px!important;width:100%!important;margin:0!important}
  #shell#shell[data-view-mode=chat] #composer .calm-mobile-option > #ascendant-route-label > span {max-width:none!important;width:auto!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;font-size:13px!important}
 }
 @media screen and (min-width:800px) {
  #shell#shell[data-view-mode=chat] #main > .composer-area:has(> #composer:not(.expanded):not(.shared-composer-expanded)) > :is(.b1x-live-chips,.disclaimer) {
   display:none!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) {
   display:flex!important;flex-flow:row wrap!important;align-items:center!important;
   width:min(100%,1040px)!important;max-width:1040px!important;min-height:0!important;height:auto!important;
   gap:4px!important;padding:5px 8px!important;margin:0 auto!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) #prompt {
   flex:1 1 200px!important;width:auto!important;min-width:180px!important;
   height:36px!important;min-height:36px!important;max-height:36px!important;
   padding:6px 4px!important;margin:0!important;line-height:24px!important;overflow-y:auto!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) .composer-toolbar {
   display:flex!important;flex:0 0 auto!important;flex-flow:row nowrap!important;align-items:center!important;
   width:auto!important;min-width:0!important;gap:2px!important;min-height:36px!important;height:36px!important;padding:0!important;margin:0!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) .composer-toolbar :is(.composer-btn,.calm-tools>summary,#composer-size-toggle,#composer-live-audio) {
   width:32px!important;min-width:32px!important;flex:0 0 32px!important;min-height:36px!important;height:36px!important;padding:4px!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) .composer-toolbar #composer-web-btn {
   width:auto!important;min-width:48px!important;flex-basis:auto!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) .composer-model-control {
   flex:0 1 auto!important;width:auto!important;min-width:112px!important;max-width:160px!important;margin:0!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) .composer-toolbar :is(#send,#stop) {
   flex:0 0 36px!important;width:36px!important;min-width:36px!important;height:36px!important;min-height:36px!important;
  }
  #shell#shell[data-view-mode=chat] #main > .composer-area > #composer:not(.expanded):not(.shared-composer-expanded):not([data-manual-size=true]) > :is(.composer-context,.project-context) {
   flex:1 0 100%!important;width:100%!important;
  }
 }
}

/* Keep writing controls above the visual viewport's keyboard edge. */
@layer composer-refinement {
 @media screen and (max-width:799px) {
  :root[data-chat-keyboard-open=true] #shell#shell[data-view-mode=chat] #main .composer-area {
   position:fixed!important;left:var(--composer-screen-left,0px)!important;right:var(--composer-screen-right,0px)!important;
   top:auto!important;width:auto!important;max-width:none!important;box-sizing:border-box!important;transform:none!important;
   margin:0!important;padding-inline:8px!important;
   bottom:var(--composer-mobile-bottom,var(--composer-keyboard-bottom,0px))!important;
   padding-bottom:3px!important;
  }
  :root[data-chat-keyboard-open=true] #shell#shell[data-view-mode=chat] .refined-mobile-nav,
  :root[data-chat-keyboard-open=true] #shell#shell[data-view-mode=chat] #main .composer-area > :is(.launch-footer,.workspace-legal-footer,.b1x-live-chips,.disclaimer,.calm-latest,.b1x-followup-bar) {display:none!important}
  :root[data-chat-keyboard-open=true] #shell#shell[data-view-mode=chat] #composer:is(.expanded,.shared-composer-expanded) #prompt {
   min-height:60px!important;height:min(110px,calc(var(--composer-visible-height,400px)*.28))!important;max-height:min(110px,calc(var(--composer-visible-height,400px)*.28))!important;
  }
  :root[data-chat-keyboard-open=true] #shell#shell[data-view-mode=chat] #composer .composer-context {max-height:32px!important;overflow:auto!important;flex-wrap:nowrap!important}
 }
 #shell#shell[data-view-mode=chat] #composer.file-drop-ready {outline:2px dashed var(--accent,#7554ad)!important;outline-offset:3px}
 #shell#shell[data-view-mode=chat] #composer.file-drop-ready::after {content:'Drop files or images to attach';position:absolute;bottom:100%;left:8px;padding:6px 10px;background:var(--panel,#fff);border:1px solid currentColor;border-radius:8px;font:13px/1.4 system-ui;pointer-events:none}
}
