/* RD NovaSphere V117 — final site-wide QA/stability layer for system pages only. */
html.rd-v117-system,html.rd-v117-system body{max-width:100%;}
html.rd-v117-system body{overflow-x:clip;}
html.rd-v117-system *,html.rd-v117-system *::before,html.rd-v117-system *::after{box-sizing:border-box;}
html.rd-v117-system :where(img,video,svg,canvas,iframe){max-width:100%;}
html.rd-v117-system :where(input,select,textarea,button){min-width:0;max-width:100%;}
html.rd-v117-system :where(h1,h2,h3,h4,h5,h6,button,a,.btn,.pill,.badge,.chip,label){word-break:normal;overflow-wrap:normal;hyphens:none;}
html.rd-v117-system :where(pre,code,.mono,.url){overflow-wrap:anywhere;word-break:break-word;}
html.rd-v117-system :where(.row,.grid,.cards,.card-grid,.grid2,.grid3,.connector-grid,.formgrid,.navlinks,.nav-links){min-width:0;}
html.rd-v117-system :where(.card,.panel,.tile,.box,.hero-card,.guide-card,.view,.section-card,.content-card){max-width:100%;}

/* Persistent system navigation: sticky on laptop/desktop, fixed + correctly spaced on phones. */
html.rd-v117-system .rd-v117-sticky-header{position:sticky!important;top:0!important;z-index:2147481200!important;transform:none!important;translate:none!important;}
.rd-v117-mobile-spacer{display:none;width:100%;pointer-events:none;}
@media(max-width:820px){
  html.rd-v117-system body.rd-v117-fixed-header .rd-v117-sticky-header{position:fixed!important;left:0!important;right:0!important;top:0!important;width:100%!important;margin:0!important;}
  html.rd-v117-system body.rd-v117-fixed-header .rd-v117-mobile-spacer{display:block!important;height:var(--rd-v117-header-h,72px)!important;}
  html.rd-v117-system :where(.navlinks,.nav-links,header nav,.top nav,.topbar nav){max-width:100%;min-width:0;}
  html.rd-v117-system :where(.navlinks,.nav-links){overflow-x:auto!important;overflow-y:hidden!important;-webkit-overflow-scrolling:touch;scrollbar-width:none;white-space:nowrap!important;flex-wrap:nowrap!important;}
  html.rd-v117-system :where(.navlinks,.nav-links)::-webkit-scrollbar{display:none;}
  html.rd-v117-system :where(.navlinks,.nav-links) > *{flex:0 0 auto!important;white-space:nowrap!important;}
  html.rd-v117-system :where(.formgrid,.grid2,.grid3,.connector-grid){min-width:0;}
  html.rd-v117-system :where(table){max-width:100%;}
  html.rd-v117-system :where(.table-wrap,.table-scroll,.data-table-wrap){max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;}
}

/* Contextual NovaAI: the page behind stays locked; the answer area itself owns vertical scroll. */
html.rd-nova-context-open,html.rd-nova-context-open body{overscroll-behavior:none!important;overflow:hidden!important;}
html.rd-nova-context-open body{touch-action:auto!important;}
.nova-context-panel{position:fixed!important;overscroll-behavior:contain!important;touch-action:manipulation!important;}
.nova-context-messages{flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain!important;-webkit-overflow-scrolling:touch!important;touch-action:pan-y!important;}
.nova-context-head,.nova-context-compose,.nova-context-voicebar{flex:0 0 auto!important;}
.nova-context-compose,.nova-context-compose textarea,.nova-context-actions,.nova-context-action-buttons{min-width:0!important;max-width:100%!important;}
@media(max-width:820px){
  .nova-context-panel{left:max(8px,env(safe-area-inset-left,0px))!important;right:max(8px,env(safe-area-inset-right,0px))!important;top:auto!important;bottom:max(8px,env(safe-area-inset-bottom,0px))!important;width:auto!important;max-width:none!important;height:min(86dvh,var(--rd-vv-height,86dvh))!important;max-height:min(86dvh,var(--rd-vv-height,86dvh))!important;overflow:hidden!important;}
  .nova-context-actions{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-items:end!important;gap:.55rem!important;}
  .nova-context-action-buttons{display:flex!important;flex-wrap:wrap!important;justify-content:flex-end!important;gap:.45rem!important;}
  .nova-context-send{min-width:86px!important;}
  .nova-context-voicebar{display:flex!important;flex-wrap:wrap!important;gap:.45rem!important;align-items:center!important;}
}
@media(max-width:430px){
  .nova-context-actions{grid-template-columns:1fr!important;}
  .nova-context-action-buttons{justify-content:stretch!important;}
  .nova-context-action-buttons > button{flex:1 1 auto!important;}
}

/* NovaCommerce final fit/alignment protections. */
html.rd-v117-system body:has([data-commerce-app]),html.rd-v117-system body:has(.commerce-shell){overflow-x:clip;}
@media(max-width:820px){
  html.rd-v117-system .connector-grid{grid-template-columns:1fr!important;}
  html.rd-v117-system .channel-edit{min-width:0!important;max-width:100%!important;}
  html.rd-v117-system .channel-edit input,html.rd-v117-system .channel-edit select{width:100%!important;}
  html.rd-v117-system #productForm .formgrid{grid-template-columns:1fr!important;}
}
