/* MGB System · encabezado de dos niveles en todas las páginas públicas.
   Nivel 1: logo | búsqueda | carrito. Nivel 2: menú completo.
   La lógica de navegación y compras permanece intacta. */
header.mgb-header-v2{--mgb-head-ink:#153446;--mgb-head-line:#dde9ef;background:#fff;color:var(--mgb-head-ink)}
header.mgb-header-v2 .mgb-header-layout{
  display:grid!important;
  grid-template-columns:minmax(64px,100px) minmax(0,1fr) max-content;
  grid-template-rows:minmax(62px,auto) auto;
  column-gap:clamp(12px,2.2vw,28px);row-gap:0;
  align-items:center;justify-items:stretch;
  box-sizing:border-box;width:min(1340px,calc(100% - 32px))!important;
  max-width:1340px;margin-inline:auto!important;
  min-height:0!important;padding:8px 0 0!important;
  flex-wrap:unset!important;
}
header.mgb-header-v2 .mgb-header-layout>:is(.logo,.brand,.brandmark,.cat-logo){
  grid-column:1;grid-row:1;justify-self:start;align-self:center;
  display:flex;align-items:center;justify-content:flex-start;
  min-width:0;max-width:100px;width:auto!important;height:auto!important;
  margin:0!important;flex:none!important;
}
header.mgb-header-v2 .mgb-header-layout>:is(.logo,.brand,.brandmark,.cat-logo) img{
  display:block;width:auto!important;max-width:100%;height:58px!important;
  max-height:58px;object-fit:contain;
}
header.mgb-header-v2 .mgb-header-layout>:is(form.search,form.mgb-global-search){
  grid-column:2;grid-row:1;justify-self:center;align-self:center;
  width:100%!important;max-width:560px!important;min-width:0!important;
  flex:none!important;order:unset!important;margin:0!important;
}
header.mgb-header-v2 .mgb-header-layout>form.search{padding:5px 9px!important;min-height:47px}
header.mgb-header-v2 .mgb-header-layout>form.search input{min-width:0}
header.mgb-header-v2 .mgb-header-layout>:is(#mgbHeaderCartButton,#catCartButton){
  grid-column:3;grid-row:1;justify-self:end;align-self:center;
  margin:0!important;order:unset!important;
  min-height:44px;white-space:nowrap;
}
header.mgb-header-v2 .mgb-header-layout>nav{
  grid-column:1 / -1;grid-row:2;align-self:stretch;
  display:flex!important;align-items:center;justify-content:center!important;
  flex-wrap:wrap!important;gap:5px clamp(10px,1.35vw,20px)!important;
  width:100%!important;max-width:none!important;min-width:0!important;
  flex:none!important;order:unset!important;margin:0!important;
  padding:9px 0 10px!important;
  border:0;border-top:1px solid var(--mgb-head-line);
  background:#fff;color:#152e40;
  font:750 12.5px/1.35 system-ui,-apple-system,"Segoe UI",Arial,sans-serif;
}
header.mgb-header-v2 .mgb-header-layout>nav>a,
header.mgb-header-v2 .mgb-header-layout>nav>.shopbox>button,
header.mgb-header-v2 .mgb-header-layout>nav>.mgb-shop>button{
  display:inline-flex;align-items:center;justify-content:center;
  padding:7px 2px!important;margin:0!important;
  min-height:34px;font:inherit!important;line-height:1.3!important;
  white-space:nowrap;text-align:center;
}
header.mgb-header-v2 .mgb-header-layout>nav>a:hover,
header.mgb-header-v2 .mgb-header-layout>nav>button:hover{color:#075b79}
header.mgb-header-v2 .mgb-header-layout>nav>.mgb-shop{flex:0 0 auto;width:auto}
header.mgb-header-v2 .mgb-header-layout>nav>.shopbox{flex:0 0 auto}
header.mgb-header-v2 .mgb-header-layout>:is(.header-action,a:not(.brand):not(.logo):not(.brandmark):not(.cat-logo)){
  display:none!important;
}
/* El contexto de cada sección permanece en su hero, para no sumar una tercera barra. */
header.mgb-header-v2>.section-location{display:none!important}
/* Los toggles están reservados al modo compacto. */
@media(min-width:901px){
 header.mgb-header-v2 .mgb-header-layout>:is(.menu-toggle,.mobiletoggle,.cat-menu-toggle,.mgb-mobile-nav-toggle){display:none!important}
}
/* Encabezados independientes de 404 y resultado del pago. */
header.mgb-header-v2.mgb-header-layout{
  width:100%!important;max-width:none!important;
  grid-template-columns:max-content minmax(0,1fr) max-content;
  padding:10px max(16px,calc((100% - 1340px)/2)) 0!important;
}
header.mgb-header-v2.mgb-header-layout>a:first-child{
  font-size:clamp(16px,1.5vw,20px);line-height:1.2;white-space:nowrap;
}
header.mgb-header-v2.mgb-header-layout>a:first-child{grid-column:1;grid-row:1;align-self:center}
header.mgb-header-v2.mgb-header-layout>.mgb-global-search{grid-column:2;grid-row:1}
header.mgb-header-v2.mgb-header-layout>#mgbHeaderCartButton{grid-column:3;grid-row:1}
header.mgb-header-v2.mgb-header-layout>nav{grid-column:1/-1;grid-row:2}
/* Móvil: logo + carrito + menú; búsqueda en la fila siguiente.
   Los enlaces solo se muestran al abrir el menú hamburguesa existente. */
@media(max-width:900px){
 header.mgb-header-v2 .mgb-header-layout{
   grid-template-columns:minmax(44px,auto) minmax(0,1fr) auto auto;
   grid-template-rows:auto auto auto;
   column-gap:8px;row-gap:7px;
   width:calc(100% - 24px)!important;
   padding:7px 0 8px!important;
 }
 header.mgb-header-v2 .mgb-header-layout>:is(.logo,.brand,.brandmark,.cat-logo){grid-column:1;grid-row:1;max-width:68px}
 header.mgb-header-v2 .mgb-header-layout>:is(.logo,.brand,.brandmark,.cat-logo) img{height:49px!important;max-height:49px}
 header.mgb-header-v2 .mgb-header-layout>:is(#mgbHeaderCartButton,#catCartButton){grid-column:3;grid-row:1;margin:0!important;min-height:42px;padding:7px 9px}
 header.mgb-header-v2 .mgb-header-layout>:is(.menu-toggle,.mobiletoggle,.cat-menu-toggle,.mgb-mobile-nav-toggle){
   display:inline-flex!important;align-items:center;justify-content:center;
   grid-column:4;grid-row:1;justify-self:end;align-self:center;
   margin:0!important;order:unset!important;
   width:auto;min-width:44px;min-height:44px;padding:7px 9px;
   border-radius:9px;cursor:pointer;
 }
 header.mgb-header-v2 .mgb-header-layout>:is(form.search,form.mgb-global-search){
   grid-column:1/-1;grid-row:2;justify-self:stretch;
   width:100%!important;max-width:none!important;margin:0!important;
   flex:none!important;order:unset!important;
 }
 header.mgb-header-v2 .mgb-header-layout>nav{
   grid-column:1/-1;grid-row:3;
   display:none!important;flex-direction:column!important;align-items:stretch!important;
   justify-content:flex-start!important;gap:3px!important;
   max-height:min(65dvh,510px);overflow-y:auto;overscroll-behavior:contain;
   border:1px solid #d7e6ee;border-radius:10px;padding:8px!important;
   background:#f6fafc;
 }
 header.mgb-header-v2 .mgb-header-layout>nav:is(.open,.is-open),
 header.mgb-header-v2 .mgb-header-layout.mgb-mobile-menu-open>nav{
   display:flex!important;
 }
 header.mgb-header-v2 .mgb-header-layout>nav>a,
 header.mgb-header-v2 .mgb-header-layout>nav>.shopbox,
 header.mgb-header-v2 .mgb-header-layout>nav>.mgb-shop{
   width:100%!important;min-height:42px;justify-content:flex-start;
 }
 header.mgb-header-v2 .mgb-header-layout>nav>a,
 header.mgb-header-v2 .mgb-header-layout>nav>.shopbox>button,
 header.mgb-header-v2 .mgb-header-layout>nav>.mgb-shop>button{
   justify-content:flex-start;padding:10px 11px!important;
   text-align:left;width:100%!important;
 }
 header.mgb-header-v2 .mgb-header-layout>nav .mgb-shop-menu{
   position:static!important;left:auto!important;top:auto!important;
   width:100%!important;max-height:min(42dvh,330px);
 }
 header.mgb-header-v2.mgb-header-layout{
   width:100%!important;padding:8px 12px!important;
 }
 header.mgb-header-v2.mgb-header-layout>nav{display:flex!important;max-height:none}
 header.mgb-header-v2.mgb-header-layout>:is(.mgb-global-search){grid-column:1/-1;grid-row:2}
 header.mgb-header-v2.mgb-header-layout>#mgbHeaderCartButton{grid-column:3;grid-row:1}
}
@media(max-width:420px){
 header.mgb-header-v2 .mgb-header-layout>:is(#mgbHeaderCartButton,#catCartButton){gap:4px;font-size:12px;padding:7px 8px}
 header.mgb-header-v2 .mgb-header-layout>:is(#mgbHeaderCartButton,#catCartButton) svg{width:17px;height:17px}
}
