/* MAHIN GLOBAL-FIRST PAGE SHELL — THE ONE page title / page action contract.
 * Two title variants: --banner (decorated semantic banner role), --plain.
 * Component geometry only; colors/paint use existing global Design Engine &
 * control-system.css; themes/signature/corner/surface modes work automatically.
 * Future module: <header class="mi-page-header mi-page-header--banner mi-ui-titlebar mi-ui-titlebar--banner mi-ui-settings-banner">
 * <div class="mi-page-header__leading"><button class="button secondary mi-page-action mi-page-header__back">Back</button>
 * <div class="mi-page-header__copy"><h1>Title</h1><p>Description</p></div></div>
 * <div class="mi-page-header__actions"><button class="button mi-page-action">Add</button></div></header>
 * Save/Upload controls belong to form footers, never the page header.
 */
html #appScreen#appScreen .mi-page-header {
  box-sizing:border-box!important;
  display:flex!important;
  flex-wrap:nowrap!important;
  justify-content:space-between!important;
  align-items:center!important;
  gap:clamp(10px,1.4vw,20px)!important;
  min-width:0!important;
  width:100%!important;
  margin-block:0 18px!important;
}
/* Hidden is an accessibility/state contract, never overridden by header geometry. */
html #appScreen#appScreen .mi-page-header[hidden] {display:none!important;}
html #appScreen#appScreen .mi-page-header--banner {
  min-height:86px!important;
  padding:clamp(13px,1.65vw,22px)!important;
  border-radius:var(--mi-corner-banner,var(--mi-ui-radius-titlebar,15px))!important;
}
html #appScreen#appScreen .mi-page-header--plain {
  background:none!important;
  border:none!important;
  box-shadow:none!important;
  padding:0!important;
}
html #appScreen#appScreen .mi-page-header > .mi-page-header__leading {
  min-width:0!important;
  display:flex!important;
  flex:1 1 auto!important;
  align-items:center!important;
  gap:clamp(9px,1.2vw,16px)!important;
  flex-wrap:nowrap!important;
}
html #appScreen#appScreen .mi-page-header__copy {min-width:0;flex:1 1 auto;overflow-wrap:anywhere;}
html #appScreen#appScreen .mi-page-header__copy :is(h1,h2,h3) {
  margin:0!important;
  font-size:clamp(19px,2.1vw,29px)!important;
  line-height:1.22!important;
  font-weight:750!important;
  letter-spacing:-.02em;
}
html #appScreen#appScreen .mi-page-header__copy :is(p,small) {
  margin:4px 0 0!important;
  font-size:clamp(11px,1.05vw,13px)!important;
  line-height:1.4!important;
  max-width:72ch;
  color:inherit!important;
  opacity:.9;
}
html #appScreen#appScreen .mi-page-header__copy :is(.mi-appearance-eyebrow,.mi-preferences-eyebrow,.mi-hub-eyebrow) {display:none!important;}
html #appScreen#appScreen .mi-page-header__actions {
  flex:0 0 auto!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  flex-wrap:wrap!important;
}
html #appScreen#appScreen .mi-page-header__actions:empty {display:none!important;}
html #appScreen#appScreen .mi-page-header .mi-page-header__back {
  flex:0 0 auto!important;
  white-space:normal!important;
  margin:0!important;
  display:inline-flex;
  align-items:center;
  max-width:min(32vw,180px);
  text-align:center;
}
/* The one Page Action inherits EXACTLY the Dashboard Customize / global
 * button paint from control-system.css; only shared geometry is owned here.
 * Primary/secondary/danger are semantic variants, never module-specific. */
html #appScreen#appScreen button.mi-page-action {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  box-sizing:border-box;
  min-height:36px;
  padding:8px 12px;
  font:inherit;
  font-size:12px;
  font-weight:650;
  line-height:1.22;
  border-radius:var(--mi-control-radius,var(--mi-global-control-radius,10px))!important;
  cursor:pointer;
  text-decoration:none;
}
/* All action colors, hover states, shadows and themes are owned by
 * control-system.css, shared by Save, Upload, Add, Customize and list actions. */
html #appScreen#appScreen button.mi-page-action:is(:disabled,[aria-disabled="true"]) {
  opacity:.6!important;pointer-events:none!important;cursor:not-allowed!important;
}
html #appScreen#appScreen .mi-page-header__actions .mi-page-action-inactive {display:none!important;}
html #appScreen#appScreen .mi-page-header__actions [hidden],html #appScreen#appScreen .mi-page-header [hidden] {display:none!important;}
/* Source headings remain in the feature DOM for its existing JS selectors,
 * while their presentation is owned by ONE canonical page header. */
#appScreen .mi-page-managed .mi-page-source-heading,
#appScreen .mi-page-managed .mi-page-source-description,
#appScreen .mi-page-managed .mi-page-source-section-head {display:none!important;}
#appScreen .mi-page-managed > .mi-page-header + section {min-width:0;}
/* Old dashboard's isolated toolbar geometry must not override shared banner. */
#appScreen #miDashboardView .mi-dash-toolbar.mi-page-header {margin-bottom:16px!important;}
#appScreen #miDashboardView .mi-dash-heading.mi-page-header__leading {flex:1 1 auto!important;}
/* Keep the menu hover and focused action layout reusable, never hover-only. */
#appScreen :is(.mi-page-action,.mi-ui-button,.button):focus-visible {
  outline:2px solid var(--mi-control-focus,var(--mi-ds-focus,#4389dd))!important;
  outline-offset:2px!important;
}
@media (max-width:680px) {
  html #appScreen#appScreen .mi-page-header {align-items:stretch!important;flex-wrap:wrap!important;gap:10px!important;}
  html #appScreen#appScreen .mi-page-header > .mi-page-header__leading {flex:1 1 100%!important;}
  html #appScreen#appScreen .mi-page-header__actions {width:100%!important;justify-content:flex-end!important;}
  html #appScreen#appScreen .mi-page-header__actions:empty {display:none!important;}
  html #appScreen#appScreen .mi-page-header__copy :is(h1,h2,h3){font-size:clamp(19px,4.6vw,26px)!important;}
  html #appScreen#appScreen .mi-page-header__back {max-width:43vw!important;}
}
@media (prefers-reduced-motion:reduce){html #appScreen#appScreen .mi-page-header * {transition:none!important;}}
