/* One working surface, with stable DOM/lane ownership. Only overflowing content scrolls. */
body.entered{--workspace-gap:20px;--workspace-footer:24px;--workspace-columns:minmax(0,1fr);--workspace-areas:"center"}
body.entered:has(.demo-controls){--workspace-footer:116px}
body.entered .growth-block{min-width:0}
body.entered :is(.growth-body,.artifact-body,.document-comparison,.table-scroll){scrollbar-width:thin;scrollbar-color:var(--line,#dce3da) transparent}
body.entered [data-lane]:not(:has(.growth-block:not([hidden]))){display:none}
body.entered .growth-body{overflow-wrap:anywhere}
/* The desktop keeps a readable writing column and makes room only for occupied lanes. */
@media(min-width:980px) and (min-height:650px){
 body.entered .page{display:grid;grid-template-areas:"header" "working" "artifacts";grid-template-rows:auto minmax(0,1fr) auto;gap:14px;width:100%;max-width:1920px;height:100dvh;min-height:0;margin:0 auto;padding:20px 30px var(--workspace-footer)!important;box-sizing:border-box}
 body.entered #surface-bar{grid-area:header;margin:0!important;min-height:22px;padding:0 3px}
 body.entered #adaptive-grid{grid-area:working;display:grid!important;grid-template-columns:var(--workspace-columns)!important;grid-template-areas:var(--workspace-areas);grid-template-rows:minmax(0,1fr);align-items:stretch;gap:var(--workspace-gap);min-height:0;min-width:0}
 body.entered:has([data-lane=left] .growth-block:not([hidden])){--workspace-columns:minmax(180px,.75fr) minmax(400px,2.5fr);--workspace-areas:"left center"}
 body.entered:has([data-lane=right] .growth-block:not([hidden])){--workspace-columns:minmax(400px,2.5fr) minmax(240px,1fr);--workspace-areas:"center right"}
 body.entered:has([data-lane=left] .growth-block:not([hidden])):has([data-lane=right] .growth-block:not([hidden])){--workspace-columns:minmax(170px,.7fr) minmax(360px,2.2fr) minmax(230px,1fr);--workspace-areas:"left center right"}
 body.entered [data-lane=left]{grid-area:left}
 body.entered [data-lane=right]{grid-area:right}
 body.entered .growth-center{grid-area:center;min-width:0;min-height:0!important;display:flex;flex-direction:column;gap:14px;padding:0 16px!important;overflow:visible}
 body.entered :is([data-lane=left],[data-lane=right]){display:flex;flex-direction:column;gap:18px;min-height:0;padding-top:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-inline:3px;scroll-padding:16px}
 body.entered :is([data-lane=left],[data-lane=right])>.growth-block{flex:1 1 180px;min-height:140px;display:flex;flex-direction:column}
 body.entered .growth-head{flex:0 0 auto;margin-bottom:9px}
 body.entered .growth-block>.growth-body{min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;padding-right:5px;scroll-padding:12px}
 body.entered .composer{flex:0 0 auto;width:100%;max-width:none;margin:0}
 body.entered:not([data-surface=writing]) .capsule{padding:10px 13px;border-radius:26px;box-shadow:0 4px 20px var(--shadow,#253c300b)}
 body.entered:not([data-surface=writing]) #request{max-height:84px!important;overflow:auto}
 body.entered #capsule-context{margin:0;padding-top:3px}
 body.entered #semantic-status{margin:2px 0}
 body.entered [data-lane=bottom]{flex:1 1 0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(240px,100%),1fr));grid-auto-rows:minmax(160px,1fr);align-content:stretch;align-items:stretch;gap:16px;margin:0;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 3px 3px;scroll-padding:12px}
 body.entered [data-lane=bottom]>.growth-block{min-height:0;display:flex;flex-direction:column}
 body.entered [data-lane=bottom]>:is([data-block=market],[data-block=comparison]){grid-column:1/-1}
 body.entered [data-lane=bottom]:not(:has(.growth-block:not([hidden]))){display:none}
 /* The editor is the document: no duplicate title or outer paper card. */
 body.entered[data-surface=writing] #writer-heading{flex:0 0 auto;padding-top:8px}
 body.entered[data-surface=writing] .document-eyebrow{top:-8px}
 body.entered[data-surface=writing] #writer-format{padding:6px 0 10px;margin:0;gap:6px}
 body.entered[data-surface=writing] .composer{flex:1 1 0;min-height:160px;display:flex;flex-direction:column}
 body.entered[data-surface=writing] .capsule{flex:1 1 0;min-height:0;display:flex;align-items:stretch}
 body.entered[data-surface=writing] #request{height:100%!important;min-height:0!important;max-height:none!important;overflow:auto!important;padding:8px 12px 40px 0;line-height:1.9;font-size:17px;resize:none;overscroll-behavior:contain;scrollbar-gutter:stable}
 body.entered[data-surface=writing] #document-preview{flex:1 1 0;min-height:160px;max-height:100%;overflow:auto;padding:8px 12px 40px 0;font-size:17px;line-height:1.9}
 body.entered[data-surface=writing]:has(#document-preview:not([hidden])) .composer{flex:0 0 auto;min-height:0}
 body.entered[data-surface=writing] [data-lane=bottom]:has(.growth-block:not([hidden])){flex:0 1 38%;min-height:150px;max-height:42%}
 /* Existing artifact projections remain available without pushing the working set off-screen. */
 body.entered #workspace:not([hidden]){grid-area:artifacts;min-height:0;max-height:30dvh;overflow:auto;overscroll-behavior:contain;margin:0!important;padding:0 3px}
 body.entered #workspace>.work-heading{margin:0 0 12px}
 body.entered #workspace .artifact-body{max-height:20dvh;overflow:auto}
 body.entered .image-inspector img{max-height:36dvh}
 body.entered .image-grid{gap:10px}
 body.entered .image-grid img{height:85px}
 body.entered .source-document{padding:10px 0}
 /* A market block gets a broad central surface; its chart appears before secondary detail. */
 body.entered [data-block=market] .market-overview{padding:2px 0 13px}
 body.entered [data-block=market] .market-summary-strip{margin-bottom:16px}
 body.entered [data-block=market] .market-summary{padding:11px 12px}
 body.entered [data-block=market] .market-summary strong{font-size:21px}
 body.entered [data-block=market] .market-workbench-body{gap:20px}
 body.entered [data-block=market] .market-watchlist{padding-right:14px}
 body.entered [data-block=market] .market-watch-row{padding:10px 7px}
 body.entered [data-block=market] .market-detail-price{margin:12px 0 16px}
 body.entered [data-block=market] .market-detail-price strong{font-size:34px}
 body.entered [data-block=market] .market-metrics{margin-bottom:16px;gap:10px 18px}
 body.entered [data-block=market] .market-main-chart{min-height:150px;max-height:30dvh}
 body.entered [data-block=market] .market-provenance{margin-top:12px;padding-top:10px}
}
/* Smaller screens keep the same objects and lane order; text never becomes a narrow strip. */
@media(max-width:979px),(max-height:649px){
 body.entered .page{max-width:100%;padding:22px 20px var(--workspace-footer)!important;min-height:100dvh}
 body.entered #surface-bar{margin:0 0 18px!important}
 body.entered #adaptive-grid{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:20px;align-items:start}
 body.entered .growth-center{grid-column:1/-1;grid-row:1;width:100%;min-width:0;min-height:0!important;padding:0!important}
 body.entered [data-lane=left]{grid-column:1;grid-row:2}
 body.entered [data-lane=right]{grid-column:2;grid-row:2}
 body.entered :is([data-lane=left],[data-lane=right]){padding:0;min-width:0;gap:18px}
 body.entered:has([data-lane=left] .growth-block:not([hidden])):not(:has([data-lane=right] .growth-block:not([hidden]))) [data-lane=left],body.entered:has([data-lane=right] .growth-block:not([hidden])):not(:has([data-lane=left] .growth-block:not([hidden]))) [data-lane=right]{grid-column:1/-1}
 body.entered .composer{width:100%}
 body.entered[data-surface=writing] #request,body.entered[data-surface=writing] #document-preview{height:clamp(240px,52dvh,540px)!important;min-height:240px!important;max-height:540px!important;overflow:auto!important;padding:16px 3px 32px;line-height:1.95}
 body.entered [data-lane=bottom]{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr));gap:18px;margin-top:20px}
 body.entered [data-lane=bottom]>:is([data-block=market],[data-block=comparison]){grid-column:1/-1}
 body.entered [data-lane]:not(:has(.growth-block:not([hidden]))){display:none}
 body.entered .growth-body{max-height:65dvh;overflow:auto;overscroll-behavior:contain}
 body.entered [data-block=market]>.growth-body{max-height:80dvh}
}
@media(max-width:560px){
 body.entered .page{padding-inline:16px!important}
 body.entered #adaptive-grid{grid-template-columns:minmax(0,1fr)!important;gap:22px}
 body.entered [data-lane=left]{grid-column:1;grid-row:2}
 body.entered [data-lane=right]{grid-column:1;grid-row:3}
 body.entered #writer-format{flex-wrap:wrap}
}
