/*
  Stage 105.3M CLEAN v4 — Platform Page Heading Standardisation / Nested Legacy Hero Target
  Built cleanly from confirmed Stage 105.3L CLEAN.

  Diagnosis from failed 105.3M v2/v3:
  - some Setup pages render their real heading inside a page wrapper, e.g. .s1012q-page > .s1012q-hero
  - the previous guard could style the wrapper while the nested old dark hero kept its own CSS
  - this version targets the nested legacy hero/header element itself

  Normal page standard: Company Documents / Data Accounts style.
  Customer 360 profile/workbench pages keep their own profile header.
  Visual-only CSS. No route, API, backend, data-save, billing, SageOne,
  RADIUS, prepaid, product, asset, job-card, calendar, Android or worker logic.
*/

:root{
  --ui1053m4-title: #071127;
  --ui1053m4-text: #172033;
  --ui1053m4-muted: #536277;
  --ui1053m4-border: rgba(148,163,184,.25);
  --ui1053m4-panel: rgba(255,255,255,.965);
  --ui1053m4-panel-soft: rgba(248,250,252,.94);
  --ui1053m4-blue: #2563eb;
  --ui1053m4-teal: #0ea5a2;
  --ui1053m4-radius: 24px;
  --ui1053m4-shadow: 0 16px 36px rgba(15,23,42,.065);
}

html[data-theme="dark"],
body.dark,
body.theme-dark{
  --ui1053m4-title: #e8f0fb;
  --ui1053m4-text: #dbe7f5;
  --ui1053m4-muted: #a9b8ca;
  --ui1053m4-border: rgba(148,163,184,.24);
  --ui1053m4-panel: rgba(15,23,42,.94);
  --ui1053m4-panel-soft: rgba(30,41,59,.76);
  --ui1053m4-blue: #60a5fa;
  --ui1053m4-teal: #2dd4bf;
  --ui1053m4-shadow: 0 18px 42px rgba(0,0,0,.26);
}

/* Main standard header card. This class is applied to the actual header/hero element,
   not to the entire page wrapper. */
html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading,
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading{
  box-sizing: border-box !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 106px !important;
  margin: 0 0 20px 0 !important;
  padding: clamp(22px, 2.2vw, 34px) clamp(24px, 2.35vw, 38px) clamp(22px, 2.2vw, 32px) clamp(34px, 2.6vw, 46px) !important;
  border: 1px solid var(--ui1053m4-border) !important;
  border-radius: var(--ui1053m4-radius) !important;
  background: linear-gradient(135deg, rgba(255,255,255,.98) 0%, rgba(240,253,250,.88) 55%, rgba(245,243,255,.78) 100%) !important;
  background-color: var(--ui1053m4-panel) !important;
  color: var(--ui1053m4-text) !important;
  -webkit-text-fill-color: initial !important;
  box-shadow: var(--ui1053m4-shadow) !important;
  overflow: visible !important;
  position: relative !important;
  isolation: isolate !important;
  text-shadow: none !important;
}

html.stage1053m4-page-heading-standard-v4 body.theme-dark #app-screen > main#page.page .ui1053m4-page-heading,
html.stage1053m4-page-heading-standard-v4 body.dark #app-screen > main#page.page .ui1053m4-page-heading,
html.stage1053m4-page-heading-standard-v4 body.theme-dark main#page .ui1053m4-page-heading,
html.stage1053m4-page-heading-standard-v4 body.dark main#page .ui1053m4-page-heading{
  background: linear-gradient(135deg, rgba(15,23,42,.96) 0%, rgba(30,41,59,.88) 58%, rgba(49,46,129,.44) 100%) !important;
  background-color: var(--ui1053m4-panel) !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading::before,
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading::before{
  content: "" !important;
  position: absolute !important;
  left: clamp(18px, 1.7vw, 30px) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 8px !important;
  height: clamp(34px, 4vw, 58px) !important;
  border-radius: 999px !important;
  background: linear-gradient(180deg, var(--ui1053m4-teal), var(--ui1053m4-blue)) !important;
  box-shadow: 0 0 0 7px rgba(37,99,235,.045) !important;
  z-index: 0 !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading > *,
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading > *{
  position: relative !important;
  z-index: 1 !important;
}

/* Flatten old nested hero/header fragments inside the detected heading. */
html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(.dark,.hero-dark,.stage-dark,.header-dark,.dark-hero,.dark-card,.banner,.hero,.page-hero,.stage-page-hero),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(.dark,.hero-dark,.stage-dark,.header-dark,.dark-hero,.dark-card,.banner,.hero,.page-hero,.stage-page-hero){
  background: transparent !important;
  color: var(--ui1053m4-text) !important;
  -webkit-text-fill-color: var(--ui1053m4-text) !important;
  box-shadow: none !important;
  border-color: transparent !important;
  text-shadow: none !important;
}

/* Typography inside standard headers. */
html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(h1,.page-title,.hero-title,.title):not(.stage1052c-tab-title):not(.tab-title),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(h1,.page-title,.hero-title,.title):not(.stage1052c-tab-title):not(.tab-title){
  margin: 0 0 8px 0 !important;
  color: var(--ui1053m4-title) !important;
  -webkit-text-fill-color: var(--ui1053m4-title) !important;
  background: transparent !important;
  font-size: clamp(30px, 2.45vw, 46px) !important;
  line-height: 1.04 !important;
  letter-spacing: -.048em !important;
  font-weight: 950 !important;
  text-shadow: none !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(h2,h3,.page-kicker,.hero-kicker,.section-kicker),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(h2,h3,.page-kicker,.hero-kicker,.section-kicker){
  color: var(--ui1053m4-title) !important;
  -webkit-text-fill-color: var(--ui1053m4-title) !important;
  background: transparent !important;
  text-shadow: none !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(p,.page-subtitle,.hero-subtitle,.subtitle,.description,.muted,.helper-text,small):not(.badge):not(.pill):not(.status-pill),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(p,.page-subtitle,.hero-subtitle,.subtitle,.description,.muted,.helper-text,small):not(.badge):not(.pill):not(.status-pill){
  margin: 0 !important;
  color: var(--ui1053m4-muted) !important;
  -webkit-text-fill-color: var(--ui1053m4-muted) !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  max-width: 980px !important;
  text-shadow: none !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]){
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  margin: 0 !important;
  max-width: 100% !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(select,input[type="text"],input[type="search"]),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(select,input[type="text"],input[type="search"]){
  max-width: min(520px, 100%) !important;
  min-height: 42px !important;
}

/* Generated wrapper for truly bare h1/h2 pages. */
html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading.ui1053m4-generated,
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading.ui1053m4-generated{
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px 24px !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading.ui1053m4-generated > :is(h1,h2,.page-title,.hero-title,.title,p,.page-subtitle,.hero-subtitle,.subtitle,.description,.muted,.helper-text,small),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading.ui1053m4-generated > :is(h1,h2,.page-title,.hero-title,.title,p,.page-subtitle,.hero-subtitle,.subtitle,.description,.muted,.helper-text,small){
  grid-column: 1 / 2 !important;
}

html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading.ui1053m4-generated > :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]),
html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading.ui1053m4-generated > :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]){
  grid-column: 2 / 3 !important;
  grid-row: 1 / span 2 !important;
  justify-self: end !important;
  align-self: center !important;
}

/* Protection areas. */
html.stage1053m4-page-heading-standard-v4 :is(
  .stage1052c-tabbed-profile,
  .stage1052c-tab-list,
  .stage1052c-panel,
  .stage822-header-card,
  .stage822-card,
  .stage833-results,
  .stage833-result,
  .stage831-dropdown,
  .submenu-bar,
  #sidebar,
  .sidebar,
  .modal,
  .modal-content,
  .popup,
  .dialog,
  table,
  thead,
  tbody
){
  --ui1053m4-title: initial;
}

@media (max-width: 1100px){
  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading.ui1053m4-generated,
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading.ui1053m4-generated{
    grid-template-columns: 1fr !important;
  }

  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]),
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]){
    justify-content: flex-start !important;
  }

  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading.ui1053m4-generated > :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]),
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading.ui1053m4-generated > :is(.page-actions,.hero-actions,.toolbar-actions,.top-actions,.actions-row,.button-row,.buttons-row,[class$="-actions"]){
    grid-column: 1 / 2 !important;
    grid-row: auto !important;
    justify-self: start !important;
  }
}

@media (max-width: 720px){
  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading,
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading{
    padding: 18px 18px 18px 30px !important;
    border-radius: 20px !important;
  }

  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading::before,
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading::before{
    left: 13px !important;
    height: 40px !important;
  }

  html.stage1053m4-page-heading-standard-v4 #app-screen > main#page.page .ui1053m4-page-heading :is(h1,.page-title,.hero-title,.title):not(.stage1052c-tab-title):not(.tab-title),
  html.stage1053m4-page-heading-standard-v4 main#page .ui1053m4-page-heading :is(h1,.page-title,.hero-title,.title):not(.stage1052c-tab-title):not(.tab-title){
    font-size: clamp(26px, 9vw, 34px) !important;
  }
}
