/* Workspace chrome follows the available canvas width, including embedded tabs. */
#workspace-shell{height:100vh;height:100dvh;min-height:0}
#workspace-stage{display:flex;flex-direction:column;min-width:0;min-height:0;container-type:inline-size}
/* The toolbar groups float on the canvas: the band behind them shows the same dot
   grid as .mwx-canvas (theme.css), and every grid is pinned to the viewport so the
   band, the canvas and Run App's layer line up as one surface with no seam. */
#workspace-stage{background-color:rgb(var(--mwx-canvas));background-image:radial-gradient(rgb(var(--mwx-canvas-dot)) 1px,transparent 1px);background-size:30px 30px}
#workspace-stage,#workspace-stage .mwx-canvas{background-attachment:fixed}
/* One row when everything fits, with the token readout beside the main action.
   When it doesn't, groups move down in this order (classes set by fitToolbar in
   canvas-manager.js): the token readout (.is-wrapped), then the main action
   (.is-tight), then the tabs. Every row aligns right, so a wrapped group stays on
   the side it was on; the project controls hold the left. */
#workspace-toolbar{position:relative;inset:auto;display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:flex-end;gap:10px;margin:16px;flex:none}
#workspace-toolbar #size-controls{flex:none;max-width:100%;flex-wrap:wrap;order:1;margin-right:auto}
#workspace-actions #token-counter{order:2}
#workspace-actions #top-action-group{order:3}
#workspace-actions .mwx-segmented{order:4}
#workspace-toolbar.is-wrapped #token-counter{order:6}
#workspace-toolbar.is-tight #top-action-group{order:5}
#workspace-actions{display:contents}
#workspace-actions>*,#workspace-toolbar button{flex-shrink:0}
#workspace-actions .mwx-segmented{display:flex;flex-wrap:wrap;max-width:100%}
#workspace-actions #top-action-group:empty{display:none}
#workspace-actions #token-counter{flex:0 1 auto;min-width:0;max-width:100%}
#workspace-actions .tu-summary,#workspace-actions .tu-metrics{flex-wrap:wrap;gap:8px 12px}
#workspace-actions .tu-metric{flex:none;white-space:nowrap}
#workspace-actions .tu-metric b{white-space:nowrap;overflow-wrap:normal}
#workspace-actions .tu-meter{position:static}
#workspace-actions .tu-panel{right:0;top:calc(100% + 6px);width:min(540px,calc(100cqw - 32px))}
#workspace-stage>#canvas-layer{position:relative;inset:auto;flex:1;min-height:0;overflow:hidden}
#workspace-stage>#live-layer{top:var(--workspace-toolbar-bottom,140px)}
#workspace-shell #ai-panel-body,#workspace-shell #ai-chatlog{overscroll-behavior:contain}
#workspace-shell #ai-panel-body>.border-t{padding-bottom:max(12px,env(safe-area-inset-bottom))}
@media(min-width:701px) and (max-width:1366px){#workspace-shell #ai-panel.w-80{width:300px}}
/* Above phone width the toolbar floats over the canvas, which fills the stage from
   the top: cards pan through the toolbar's gaps and pass beneath its groups. Only
   the groups take clicks (pointer-events-auto), so a drag in a gap pans. Phones
   keep the toolbar in its own strip — there it is several rows tall. */
@media(min-width:701px){#workspace-stage>#workspace-toolbar{position:absolute;top:0;left:0;right:0}}
@media(max-width:700px){
  #workspace-shell #ai-panel.w-80{width:min(320px,calc(100vw - 48px))}
  #workspace-shell #ai-panel.w-80~#workspace-stage{visibility:hidden}
  #workspace-toolbar{margin:10px;gap:8px}
  #workspace-actions{flex-basis:100%;justify-content:flex-start;gap:8px}
}
@media(pointer:coarse){#workspace-toolbar button,#ai-panel-toggle-btn{min-height:40px;min-width:40px}}
