/* AI Plus default front-end pages — structural normalization */
html:has(body.aip-managed-page){scroll-behavior:auto}
body.aip-managed-page{--aip-managed-top:0px;overflow-x:hidden!important}
body.admin-bar.aip-managed-page{--aip-managed-top:32px}

/* Never let a page-builder wrapper vertically center or push an AI Plus page. */
body.aip-managed-page .aip-managed-ancestor{
  min-height:0!important;
  height:auto!important;
  max-height:none!important;
  margin-top:0!important;
  padding-top:0!important;
  align-content:stretch!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
  place-content:start stretch!important;
  transform:none!important;
  translate:none!important;
}
body.aip-managed-page .aip-managed-root{
  position:relative!important;
  inset:auto!important;
  float:none!important;
  width:100%!important;
  max-width:none!important;
  min-height:0!important;
  margin-top:0!important;
  translate:none!important;
  transform:none!important;
}

/* Elementor/Gutenberg wrappers used by generated pages. */
body.aip-managed-directory-page :is(main#content,.site-main,.entry-content,.wp-site-blocks,.aip-elementor-main,.aip-elementor-inner-page),
body.aip-managed-page-auth :is(main#content,.site-main,.entry-content,.wp-site-blocks,.aip-elementor-main,.aip-elementor-inner-page){
  min-height:0!important;
  height:auto!important;
  max-width:none!important;
  margin-top:0!important;
  padding-top:0!important;
  align-items:stretch!important;
  justify-content:flex-start!important;
}
body.aip-managed-directory-page :is(.elementor,.elementor-section-wrap,.e-con.e-parent,.elementor-section,.elementor-container),
body.aip-managed-page-auth :is(.elementor,.elementor-section-wrap,.e-con.e-parent,.elementor-section,.elementor-container){
  min-height:0!important;
  justify-content:flex-start!important;
  align-content:flex-start!important;
}
body.aip-managed-directory-page :is(.elementor>.e-con.e-parent:first-child,.elementor>.elementor-section-wrap>.elementor-section:first-child),
body.aip-managed-page-auth :is(.elementor>.e-con.e-parent:first-child,.elementor>.elementor-section-wrap>.elementor-section:first-child){
  margin-top:0!important;
  padding-top:0!important;
}

/* Generated library pages should begin immediately below the site header. */
body.aip-managed-page-tools .aip-tools-directory,
body.aip-managed-page-prompts .aip-prompt-directory,
body.aip-managed-page-pricing .aip-pricing-page,
body.aip-managed-page-tool .aip-single-shell,
body.aip-managed-page-prompt .aip-single-shell{
  margin-top:0!important;
}
body.aip-managed-page-tools .aip-public-tools,
body.aip-managed-page-prompts .aip-prompt-library,
body.aip-managed-page-tool .aip-single-tool,
body.aip-managed-page-prompt .aip-single-prompt,
body.aip-managed-page-pricing :is(.aip-credit-packs,.aip-pricing-grid){
  scroll-margin-top:calc(var(--aip-managed-top) + 16px);
}

/* If an old generic page template still renders a duplicated hero before a managed shortcode,
   keep the page compact instead of leaving a viewport-sized blank region. */
body.aip-managed-directory-page .aip-page-hero{
  min-height:0!important;
  height:auto!important;
  align-items:flex-start!important;
}
body.aip-managed-directory-page .aip-page-hero + .aip-section{
  margin-top:0!important;
}

/* Full-width component containers while retaining a readable inner maximum. */
body.aip-managed-directory-page :is(.aip-public-tools,.aip-prompt-library,.aip-single-tool,.aip-single-prompt,.aip-pricing-grid,.aip-credit-packs),
body.aip-managed-page-auth .aipa-auth{
  width:100%!important;
  box-sizing:border-box!important;
}

/* Account/workspace pages already own their viewport; only neutralize outer builder wrappers. */
body.aip-managed-app-page :is(.elementor-location-single,.elementor-widget-wrap,.elementor-widget-container,.entry-content){
  margin:0!important;
  padding:0!important;
  min-height:0!important;
  max-width:none!important;
}

@media(max-width:782px){
  body.admin-bar.aip-managed-page{--aip-managed-top:46px}
  body.aip-managed-directory-page :is(.aip-container,.e-con-inner){
    width:100%!important;
    max-width:100%!important;
  }
  body.aip-managed-page-tools :is(.aip-tools-directory,.aip-section),
  body.aip-managed-page-prompts :is(.aip-prompt-directory,.aip-section),
  body.aip-managed-page-pricing :is(.aip-pricing-page,.aip-section),
  body.aip-managed-page-tool .aip-single-shell,
  body.aip-managed-page-prompt .aip-single-shell{
    padding-top:20px!important;
  }
}
body.aip-managed-page .aip-managed-empty-spacer{display:none!important;min-height:0!important;height:0!important;margin:0!important;padding:0!important}
