/* ============================================================================
   AERIS V3 FOUNDATION — LAYOUT RELIABILITY LAYER
   Additive, presentation-only corrections. Loaded last so legacy visual layers
   keep their design language while shared geometry remains bounded/responsive.
   ============================================================================ */

/* ---- universal overflow / flex-grid hardening -------------------------------- */
html,body{width:100%;max-width:100%;overflow-x:hidden}
body.v28-advanced main,body.v28-guided main,
body.v28-advanced .view,body.v28-guided .screen,
body.v28-advanced .panel,body.v28-guided .panel,
body.v28-advanced .grid,body.v28-guided .grid,
body.v28-advanced .section-head,body.v28-advanced .panel-head,
body.v28-guided .section-title,body.v28-guided .workspace-head{min-width:0}
body.v28-advanced img,body.v28-advanced video,body.v28-advanced canvas,
body.v28-guided img,body.v28-guided video,body.v28-guided canvas{max-width:100%}
body.v28-advanced .section-head>*,body.v28-advanced .panel-head>*,
body.v28-advanced .subhead>*,body.v28-guided .workspace-head>*,
body.v28-guided .section-title>*{min-width:0}

/* Shared section/panel action rows should wrap rather than push the page wider. */
body.v28-advanced .section-head,
body.v28-advanced .panel-head,
body.v28-advanced .subhead,
body.v28-advanced .reference-manager-head-v21,
body.v28-advanced .venue-toolbar-v20,
body.v28-guided .workspace-head,
body.v28-guided .understood-head,
body.v28-guided .review-footer,
body.v28-guided .pitch-footer{column-gap:14px;row-gap:10px}
body.v28-advanced .section-head .actions,
body.v28-advanced .panel-head .actions,
body.v28-advanced .subhead .actions,
body.v28-advanced .reference-manager-head-v21 .actions,
body.v28-guided .workspace-head .actions,
body.v28-guided .section-title .actions{flex-wrap:wrap;justify-content:flex-end;max-width:100%;min-width:0}
body.v28-advanced .section-head .compact-input,
body.v28-advanced .section-head .compact-select,
body.v28-advanced .panel-head .compact-input,
body.v28-advanced .panel-head .compact-select{min-width:0;max-width:100%}

/* Long project/client labels must not force cards or headers outside their box. */
body.v28-advanced .section-head h3,body.v28-advanced .panel-head h3,
body.v28-advanced .section-head p,body.v28-advanced .panel-head p,
body.v28-advanced .pulse-cell b,body.v28-advanced .pulse-cell span,
body.v28-guided h1,body.v28-guided h2,body.v28-guided h3,
body.v28-guided .project-mini,body.v28-guided .file-pill{overflow-wrap:anywhere}

/* Leave a scrollable safe zone behind the fixed AERIS dock. */
body.v28-advanced main{padding-bottom:118px!important;scroll-padding-bottom:118px}
body.v28-guided main{padding-bottom:112px!important;scroll-padding-bottom:112px}
#aerisV28Dock:not(.open){width:218px!important}
@media(max-width:1540px){#aerisV28Dock:not(.open){width:202px!important}}
@media(max-width:1250px){#aerisV28Dock:not(.open){width:188px!important;right:12px!important;bottom:12px!important}}
@media(max-width:760px){#aerisV28Dock:not(.open){width:174px!important}#aerisV28Dock.open{max-width:calc(100vw - 24px)!important;right:12px!important}}

/* ---- top chrome -------------------------------------------------------------- */
body.v28-advanced .topbar>div:first-child,body.v28-guided .topbar>div:first-child{min-width:0}
body.v28-advanced .topbar h1,body.v28-guided .topbar h1{max-width:100%}
body.v28-advanced .top-command-search{min-width:0}
body.v28-advanced .top-command-search b{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* V2.8's overflow menu owns topbar compaction; do not wrap its action strip. */
body.v28-advanced .top-actions,body.v28-guided .top-actions{min-width:0}
#aerisV281MoreMenu{max-height:min(72vh,620px);overflow:auto;overscroll-behavior:contain}

/* ---- PROJECT BRAIN / CONSTELLATION ------------------------------------------
   Root cause fixed here: aeris-v28.css sets every button to position:relative,
   which overrode .cnode-v23's absolute positioning. Keep one stable 1000×430
   coordinate system and place each node on the same endpoints used by the SVG.
   ----------------------------------------------------------------------------- */
body.v28-advanced #projectBrain .project-constellation-v23{
  overflow:hidden!important;
  padding:18px 24px 24px!important;
  margin-bottom:18px!important;
}
body.v28-advanced #projectBrain .constellation-head-v23{
  display:flex!important;flex-wrap:wrap!important;align-items:flex-start!important;
  gap:12px 18px!important;
}
body.v28-advanced #projectBrain .constellation-head-v23>div{min-width:0;flex:1 1 420px}
body.v28-advanced #projectBrain .constellation-head-v23>button{flex:0 0 auto}
body.v28-advanced #projectBrain .constellation-stage-v23{
  width:100%!important;
  max-width:1000px!important;
  aspect-ratio:1000/430!important;
  height:auto!important;
  min-height:0!important;
  margin:8px auto 0!important;
  transform:none!important;
  transform-origin:center center!important;
  overflow:visible!important;
}
body.v28-advanced #projectBrain .constellation-lines-v23{
  position:absolute!important;inset:0!important;width:100%!important;height:100%!important;
}
body.v28-advanced[data-aeris-experience="v2.8.3"] #projectBrain .cnode-v23{
  position:absolute!important;
  right:auto!important;bottom:auto!important;
  width:112px!important;height:64px!important;
  margin:0!important;
  transform:translate(-50%,-50%)!important;
  transform-origin:center!important;
}
body.v28-advanced[data-aeris-experience="v2.8.3"] #projectBrain .cnode-v23:hover{
  transform:translate(-50%,-50%) scale(1.045)!important;
}
body.v28-advanced #projectBrain .n-brief{left:50%!important;top:12.79%!important}
body.v28-advanced #projectBrain .n-theme{left:80.5%!important;top:26.74%!important}
body.v28-advanced #projectBrain .n-kv{left:87%!important;top:69.77%!important}
body.v28-advanced #projectBrain .n-stage{left:65%!important;top:89.53%!important}
body.v28-advanced #projectBrain .n-exp{left:34%!important;top:89.53%!important}
body.v28-advanced #projectBrain .n-pitch{left:13%!important;top:69.77%!important}
body.v28-advanced #projectBrain .n-prod{left:19.5%!important;top:26.74%!important}
body.v28-advanced #projectBrain .constellation-core-v23{left:50%!important;top:50%!important}

/* Health row adapts to the actual desktop content width (sidebar already consumes
   ~252px at common laptop widths). This prevents narrow, squeezed KPI cards. */
@media(max-width:1500px){
  body.v28-advanced #projectBrain .brain-health-grid-v22{grid-template-columns:repeat(4,minmax(0,1fr))!important}
  body.v28-advanced #projectBrain .health-score-v22{grid-column:span 2!important}
}
@media(max-width:900px){
  body.v28-advanced #projectBrain .brain-health-grid-v22{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v28-advanced #projectBrain .health-score-v22{grid-column:1/-1!important}
}
@media(max-width:620px){
  body.v28-advanced #projectBrain .brain-health-grid-v22{grid-template-columns:1fr!important}
  body.v28-advanced #projectBrain .health-score-v22{grid-column:auto!important}
}

/* ---- dense data cards / trackers ------------------------------------------- */
@media(max-width:1450px){
  body.v28-advanced .asset-hub-stats-v22,
  body.v28-advanced .budget-summary,
  body.v28-advanced .production-summary-grid,
  body.v28-advanced .workflow-locks{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v28-advanced .venue-measurements-v22{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v28-advanced .vault-status-grid-v220{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v28-advanced .brain-summary-v24{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  body.v28-advanced .pitch-director-matrix-v45{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:950px){
  body.v28-advanced .asset-hub-stats-v22,
  body.v28-advanced .budget-summary,
  body.v28-advanced .production-summary-grid,
  body.v28-advanced .workflow-locks,
  body.v28-advanced .venue-measurements-v22,
  body.v28-advanced .vault-status-grid-v220,
  body.v28-advanced .brain-summary-v24,
  body.v28-advanced .pitch-director-matrix-v45{grid-template-columns:1fr!important}
}

body.v28-advanced .content-row-v22{min-width:0}
@media(max-width:1180px){
  body.v28-advanced .content-row-v22{grid-template-columns:minmax(0,1.4fr) minmax(0,1fr)!important;align-items:start}
  body.v28-advanced .content-row-v22>b{grid-column:1/-1}
  body.v28-advanced .content-row-v22>*{width:100%;max-width:100%}
}
@media(max-width:700px){body.v28-advanced .content-row-v22{grid-template-columns:1fr!important}}

body.v28-advanced .production-row{min-width:0;grid-template-columns:minmax(110px,140px) minmax(0,1fr) minmax(100px,130px) minmax(72px,80px)}
@media(max-width:1050px){
  body.v28-advanced .production-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
  body.v28-advanced .production-row>*{min-width:0}
}
@media(max-width:620px){body.v28-advanced .production-row{grid-template-columns:1fr!important}}

/* ---- complex workspaces ----------------------------------------------------- */
/* Generator: avoid fixed minimums forcing horizontal overflow before the old
   1100px breakpoint. */
@media(max-width:1320px){
  body.v28-advanced #generator .immersive-generator{grid-template-columns:minmax(300px,.76fr) minmax(0,1.24fr)!important}
}
@media(max-width:1120px){body.v28-advanced #generator .immersive-generator{grid-template-columns:1fr!important}}

/* Pitch Studio: retain three-column editor where there is room, then move the
   intelligence rail below without squeezing the central slide canvas. */
@media(max-width:1520px){
  body.v28-advanced #pitchStudio .pitch-studio-grid-v20{grid-template-columns:178px minmax(0,1fr) 240px!important}
}
@media(max-width:1320px){
  body.v28-advanced #pitchStudio .pitch-studio-grid-v20{grid-template-columns:190px minmax(0,1fr)!important}
  body.v28-advanced #pitchStudio .pitch-intel-v20{grid-column:1/-1!important;position:relative!important;top:auto!important;max-height:none!important}
}
@media(max-width:900px){
  body.v28-advanced #pitchStudio .pitch-studio-grid-v20{grid-template-columns:1fr!important}
  body.v28-advanced #pitchStudio .pitch-library-v20{position:relative!important;top:auto!important;max-height:420px!important}
}

/* LED mapping: the 1450px legacy breakpoint keys off viewport width even though
   the sidebar reduces usable canvas width. Trigger the two-column workspace a
   little earlier and ensure tools/inspector cannot widen the page. */
body.v28-advanced .led-map-workspace-v30>*{min-width:0}
@media(max-width:1580px){
  body.v28-advanced .led-map-workspace-v30{grid-template-columns:180px minmax(0,1fr)!important}
  body.v28-advanced .led-map-inspector-v30{grid-column:1/-1!important;display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;align-items:start!important}
  body.v28-advanced .led-map-inspector-v30 .panel-head{grid-column:1/-1!important}
  body.v28-advanced .led-border-output-grid{grid-template-columns:1fr!important}
}
@media(max-width:920px){
  body.v28-advanced .led-map-workspace-v30{grid-template-columns:1fr!important}
  body.v28-advanced .led-map-inspector-v30{grid-template-columns:1fr!important}
  body.v28-advanced .led-map-inspector-v30>*{grid-column:auto!important}
}

/* Venue and lineage panels use large minimum widths; stack before they become
   compressed by the permanent desktop sidebar. */
@media(max-width:1380px){
  body.v28-advanced .venue-layout-v20{grid-template-columns:1fr!important}
  body.v28-advanced .lineage-layout{grid-template-columns:1fr!important}
  body.v28-advanced .qa-control-deck,body.v28-advanced .qa-grid{grid-template-columns:1fr!important}
}

/* V4.6 intelligence cards: shift to 2-up on laptop-size content areas. */
@media(max-width:1450px){
  body.v28-advanced .event-blueprint-grid-v46,
  body.v28-advanced .venue-intel-grid-v46,
  body.v28-advanced .experience-ops-v46{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:760px){
  body.v28-advanced .event-blueprint-grid-v46,
  body.v28-advanced .venue-intel-grid-v46,
  body.v28-advanced .experience-ops-v46,
  body.v28-advanced .production-intel-grid-v46,
  body.v28-advanced .resource-gates-v46{grid-template-columns:1fr!important}
}

/* Full-screen Show Day: keep the live cue view usable on laptop displays. */
@media(max-width:1180px){
  body.v28-advanced .show-day-overlay-v22.open{grid-template-columns:1fr!important;grid-template-rows:auto auto auto auto!important;overflow:auto!important;padding:42px 5vw 110px!important}
  body.v28-advanced .show-day-next-v22{border-left:0!important;border-top:1px solid rgba(78,190,240,.2);padding:20px 0 0!important}
  body.v28-advanced .show-day-details-v22{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body.v28-advanced .show-day-controls-v22{position:fixed!important;right:18px!important;bottom:18px!important}
}
@media(max-width:620px){body.v28-advanced .show-day-details-v22{grid-template-columns:1fr!important}}

/* ---- modals / drawers ------------------------------------------------------- */
body.v28-advanced .modal-wrap,body.v28-guided .progress-overlay,body.v28-guided .voice-modal-v210{padding:16px}
body.v28-advanced .modal,body.v28-advanced .voice-modal-card-v210,
body.v28-guided .progress-card,body.v28-guided .voice-modal-card-v210{
  max-width:calc(100vw - 32px);max-height:calc(100vh - 32px);overflow:auto;overscroll-behavior:contain
}
body.v28-advanced .project-chat-drawer,body.v28-guided .project-chat-drawer{max-width:100vw}

/* ---- guided-mode robustness ------------------------------------------------ */
body.v28-guided .screen{width:100%;max-width:1280px}
body.v28-guided .workspace-head,body.v28-guided .section-title,
body.v28-guided .understood-head,body.v28-guided .review-footer,
body.v28-guided .pitch-footer{flex-wrap:wrap}
body.v28-guided .workspace-head>*,body.v28-guided .section-title>*,
body.v28-guided .understood-head>*,body.v28-guided .review-footer>*,
body.v28-guided .pitch-footer>*{min-width:0}
@media(max-width:1180px){
  body.v28-guided .brief-layout{grid-template-columns:1fr!important}
  body.v28-guided .brief-side{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
}
@media(max-width:980px){
  body.v28-guided .direction-grid,body.v28-guided .stage-grid,
  body.v28-guided .experience-grid,body.v28-guided .recent-grid,
  body.v28-guided .summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:620px){
  body.v28-guided .brief-side,body.v28-guided .direction-grid,
  body.v28-guided .stage-grid,body.v28-guided .experience-grid,
  body.v28-guided .recent-grid,body.v28-guided .summary-grid{grid-template-columns:1fr!important}
}

/* ---- smallest desktop / browser zoom resilience ---------------------------- */
@media(max-width:900px){
  body.v28-advanced .section-head,body.v28-advanced .panel-head,
  body.v28-advanced .constellation-head-v23{align-items:flex-start!important;flex-direction:column!important}
  body.v28-advanced .section-head .actions,body.v28-advanced .panel-head .actions,
  body.v28-advanced .constellation-head-v23>button{width:100%;justify-content:flex-start!important}
  body.v28-advanced .section-head .actions>*{flex:1 1 160px}
}

/* ============================================================================
   AERIS V3.1.2 — IMMERSIVE SCROLL CHROME SUPPRESSION
   Goal: keep the UI scrollable, but remove visible native window scrollbars so
   AERIS feels like premium software rather than a web page. Only the content
   rail should scroll; the viewport itself should stay locked.
   ============================================================================ */
html,body{height:100%;min-height:100%}
body.v28-advanced,body.v28-guided{overflow:hidden!important}
body.v28-advanced .shell,body.v28-guided .app-shell{
  height:100vh!important;
  min-height:100vh!important;
  overflow:hidden!important;
}

/* Main workspace: scrollable, but without the visible right-edge scrollbar. */
body.v28-advanced main,
body.v28-guided main{
  height:100vh!important;
  min-height:100vh!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior-y:contain;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
body.v28-advanced main::-webkit-scrollbar,
body.v28-guided main::-webkit-scrollbar{
  width:0!important;
  height:0!important;
  display:none!important;
}

/* Keep the left navigation fixed and premium-looking. */
body.v28-advanced .sidebar,
body.v28-guided .rail{
  overflow:hidden!important;
}
body.v28-advanced .sidebar nav,
body.v28-guided .steps{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  overscroll-behavior:contain;
  scrollbar-width:none;
  -ms-overflow-style:none;
}
body.v28-advanced .sidebar nav::-webkit-scrollbar,
body.v28-guided .steps::-webkit-scrollbar{
  width:0!important;
  height:0!important;
  display:none!important;
}

/* Secondary scrollable panels should remain clean as well. */
body.v28-advanced .project-chat-drawer,
body.v28-guided .project-chat-drawer,
body.v28-advanced .modal,
body.v28-guided .voice-modal-card-v210,
body.v28-advanced .voice-modal-card-v210,
body.v28-guided .progress-card,
body.v28-advanced #aerisV281MoreMenu,
body.v28-advanced .generated-versions-v20,
body.v28-advanced .pitch-library-v20,
body.v28-advanced .reference-tray-v21,
body.v28-advanced .dashboard-quickdock-v23{
  scrollbar-width:none;
  -ms-overflow-style:none;
}
body.v28-advanced .project-chat-drawer::-webkit-scrollbar,
body.v28-guided .project-chat-drawer::-webkit-scrollbar,
body.v28-advanced .modal::-webkit-scrollbar,
body.v28-guided .voice-modal-card-v210::-webkit-scrollbar,
body.v28-advanced .voice-modal-card-v210::-webkit-scrollbar,
body.v28-guided .progress-card::-webkit-scrollbar,
body.v28-advanced #aerisV281MoreMenu::-webkit-scrollbar,
body.v28-advanced .generated-versions-v20::-webkit-scrollbar,
body.v28-advanced .pitch-library-v20::-webkit-scrollbar,
body.v28-advanced .reference-tray-v21::-webkit-scrollbar,
body.v28-advanced .dashboard-quickdock-v23::-webkit-scrollbar{
  width:0!important;
  height:0!important;
  display:none!important;
}
