/* V021.3 – Header alignment fix (presentation ONLY).
   Same original nav, notifications, menu, links and event handlers.
   All buttons keep their individual actions and their existing color meaning. */
body>header.ma-v212-header,
html[data-skin="modern"] body>header.ma-v212-header,
html[data-skin="classic"] body>header.ma-v212-header{
  grid-template-columns:156px minmax(0,1fr) 178px!important;
  grid-template-rows: minmax(52px, auto) minmax(52px,auto)!important;
  grid-template-areas:"brand nav alerts" "brand admin admin"!important;
  column-gap:14px!important;
  row-gap:7px!important;
  align-items:center!important;
  min-height:137px!important;
  padding-top:11px!important;
  padding-bottom:11px!important;
}
/* Single clean line: all primary nav surfaces exactly the same height and
   EQUAL width. Long names wrap instead of breaking button size. */
body>header.ma-v212-header #nav.ma-v212-primary-nav,
#nav.ma-v16-nav.ma-v212-primary-nav{
  display:flex!important;
  gap:6px!important;
  width:100%!important;
  min-width:0!important;
  min-height:50px!important;
  height:50px!important;
  align-items:stretch!important;
  align-self:center!important;
  overflow-x:hidden!important;
  overflow-y:hidden!important;
  margin:0!important;
  padding:0!important;
}
#nav.ma-v212-primary-nav>button:not(#maHourlyButton),
#nav.ma-v212-primary-nav>button.primary:not(#maHourlyButton){
  flex:1 1 0!important;
  box-sizing:border-box!important;
  min-width:0!important;
  width:0!important;
  max-width:none!important;
  height:50px!important;
  min-height:50px!important;
  max-height:50px!important;
  margin:0!important;
  padding:5px 6px!important;
  font-size:clamp(10px,.72vw,12px)!important;
  line-height:1.22!important;
  font-weight:750!important;
  text-align:center!important;
  white-space:normal!important;
  overflow-wrap:normal!important;
  hyphens:auto!important;
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  gap:3px!important;
  border-radius:10px!important;
  transform:none!important;
}
/* Second row: same fixed size for EVERY administration action, rather than
   content-driven widths. Preserve their individual gold/green/red styles. */
body>header.ma-v212-header #adminTopActions{
  display:flex!important;
  justify-content:flex-end!important;
  align-items:center!important;
  align-content:center!important;
  flex-wrap:nowrap!important;
  gap:8px!important;
  width:100%!important;
  min-height:50px!important;
  margin:0!important;
  padding:1px 0!important;
  box-sizing:border-box!important;
}
body>header.ma-v212-header #adminTopActions>*{
  box-sizing:border-box!important;
  flex:0 0 165px!important;
  width:165px!important;
  min-width:165px!important;
  max-width:165px!important;
  height:46px!important;
  min-height:46px!important;
  max-height:46px!important;
  margin:0!important;
}
body>header.ma-v212-header #adminTopActions>button,
body>header.ma-v212-header #adminTopActions #maHourlyButton,
body>header.ma-v212-header #adminTopActions .ma-v11-menu>.ma-v11-menu-button{
  box-sizing:border-box!important;
  display:flex!important;
  justify-content:center!important;
  align-items:center!important;
  flex-wrap:nowrap!important;
  gap:5px!important;
  width:100%!important;
  height:46px!important;
  min-height:46px!important;
  max-height:46px!important;
  margin:0!important;
  padding:6px 9px!important;
  border-radius:10px!important;
  font-size:12px!important;
  font-weight:750!important;
  line-height:1.2!important;
  white-space:normal!important;
  text-align:center!important;
  transform:none!important;
}
/* Existing menu is positioned relative to its own same-size button. */
body>header.ma-v212-header #adminTopActions .ma-v11-menu{position:relative!important;display:block!important;overflow:visible!important;}
body>header.ma-v212-header #maV16TopAlerts{align-self:center!important;min-height:50px!important;}
body>header.ma-v212-header #maNotificationDock{height:50px!important;gap:6px!important;}
body>header.ma-v212-header #maNotificationDock #workshopBell,
body>header.ma-v212-header #maNotificationDock #maActivityWork,
body>header.ma-v212-header #maNotificationDock #maActivityLeave,
body>header.ma-v212-header #maNotificationDock #maV18InvoiceBell{
  width:40px!important;min-width:40px!important;max-width:40px!important;
  height:46px!important;min-height:46px!important;max-height:46px!important;
  padding:6px!important;border-radius:10px!important;
}
/* On narrower screens prioritise legibility and avoid squashed controls;
   navigation remains in one horizontally scrollable row. */

/* Grid auto-columns are based on the number of visible navigation actions:
   the active tab's thicker border must not make that tab wider. */
body>header.ma-v212-header #nav.ma-v212-primary-nav {
  display:grid!important;
  grid-template-columns:none!important;
  grid-auto-flow:column!important;
  grid-auto-columns:minmax(0,1fr)!important;
  justify-content:stretch!important;
  align-items:stretch!important;
}
#nav.ma-v212-primary-nav>button:not(#maHourlyButton),
#nav.ma-v212-primary-nav>button.primary:not(#maHourlyButton){
  flex:none!important;width:100%!important;min-width:0!important;max-width:100%!important;
}
body>header.ma-v212-header #adminTopActions #maV16Theme,
body>header.ma-v212-header #adminTopActions #logout{
  box-sizing:border-box!important;
  height:46px!important;min-height:46px!important;max-height:46px!important;
}
@media(max-width:1370px){
  body>header.ma-v212-header,html[data-skin="modern"] body>header.ma-v212-header,html[data-skin="classic"] body>header.ma-v212-header{
    grid-template-columns:140px minmax(0,1fr) 174px!important;
    column-gap:10px!important;padding-left:14px!important;padding-right:14px!important;
  }
  body>header.ma-v212-header>.ma-v212-brand{width:140px!important;}
  #nav.ma-v212-primary-nav>button:not(#maHourlyButton){font-size:10px!important;padding:4px 3px!important;}
  body>header.ma-v212-header #adminTopActions>*{
    flex-basis:150px!important;width:150px!important;min-width:150px!important;max-width:150px!important;
  }
}
@media(max-width:1140px){
  body>header.ma-v212-header,html[data-skin="modern"] body>header.ma-v212-header,html[data-skin="classic"] body>header.ma-v212-header{
    grid-template-columns:135px minmax(0,1fr)!important;
    grid-template-rows:auto auto auto!important;
    grid-template-areas:"brand alerts" "nav nav" "admin admin"!important;
    min-height:0!important;
  }
  body>header.ma-v212-header #nav.ma-v212-primary-nav{
    display:flex!important;overflow-x:auto!important;overflow-y:hidden!important;
    justify-content:flex-start!important;
    scrollbar-width:thin!important;
  }
  #nav.ma-v212-primary-nav>button:not(#maHourlyButton),
  #nav.ma-v212-primary-nav>button.primary:not(#maHourlyButton){
    flex:0 0 135px!important;min-width:135px!important;max-width:135px!important;width:135px!important;
    font-size:11px!important;
  }
  body>header.ma-v212-header #adminTopActions{justify-content:flex-start!important;overflow-x:auto!important;}
  body>header.ma-v212-header #adminTopActions>*{flex:0 0 162px!important;width:162px!important;min-width:162px!important;max-width:162px!important;}
  body>header.ma-v212-header #maV16TopAlerts{justify-self:end!important;}
}
@media(max-width:650px){
  body>header.ma-v212-header,html[data-skin="modern"] body>header.ma-v212-header,html[data-skin="classic"] body>header.ma-v212-header{
    grid-template-columns:115px minmax(0,1fr)!important;
    gap:7px!important;
    padding:9px 10px!important;
  }
  body>header.ma-v212-header>.ma-v212-brand{width:115px!important;height:76px!important;}
  .ma-v212-brand-logo{height:75px!important;width:105px!important;}
  body>header.ma-v212-header #adminTopActions>*,body>header.ma-v212-header #adminTopActions>button{
    flex-basis:145px!important;width:145px!important;min-width:145px!important;max-width:145px!important;
  }
}
@media print{body>header.ma-v212-header{display:none!important;}}
