/* 16.1.94: oito categorias reais, tamanhos variáveis, rolagem invisível.
   Corrige o grid de oito colunas iguais criado na 16.1.93. */
body.msi-portal-results-page nav.msi-smart-categories.msi-smart-categories-1693 {
  display:flex !important;
  flex-flow:row nowrap !important;
  align-items:center !important;
  gap:10px !important;
  width:100% !important;
  min-width:0 !important;
  max-width:100% !important;
  overflow-x:auto !important;
  overflow-y:hidden !important;
  scrollbar-width:none !important;
  -ms-overflow-style:none !important;
  -webkit-overflow-scrolling:touch !important;
  white-space:nowrap !important;
  padding:2px 1px 8px !important;
  box-sizing:border-box !important;
}
body.msi-portal-results-page nav.msi-smart-categories.msi-smart-categories-1693::-webkit-scrollbar {
  width:0 !important;
  height:0 !important;
  display:none !important;
}
body.msi-portal-results-page nav.msi-smart-categories.msi-smart-categories-1693 > a {
  box-sizing:border-box !important;
  flex:0 0 auto !important;
  width:max-content !important;
  min-width:max-content !important;
  max-width:none !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin:0 !important;
  padding:12px 18px !important;
  font-size:14px !important;
  font-weight:700 !important;
  line-height:1.2 !important;
  white-space:nowrap !important;
  text-overflow:clip !important;
  overflow:visible !important;
  text-align:center !important;
  border-radius:999px !important;
}
/* O resumo permanece entre a quantidade/ordenação e os cards da listagem. */
body.msi-portal-results-page p.msi-smart-description-1688 {
  display:block !important;
  clear:both !important;
  width:100% !important;
  max-width:100% !important;
  margin:14px 0 20px !important;
  line-height:1.6 !important;
  overflow-wrap:break-word !important;
  white-space:normal !important;
}
/* Desktop: a faixa antiga e a sobreposição ficam substituídas por dois botões
   independentes e clicáveis, posicionados na parte inferior da galeria. */
@media (min-width:821px) {
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] > .msi-portal-detail-1690__actions {
    position:absolute !important;
    display:flex !important;
    flex-flow:row nowrap !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:10px !important;
    left:20px !important;
    right:auto !important;
    top:auto !important;
    bottom:20px !important;
    z-index:120 !important;
    width:max-content !important;
    max-width:calc(100% - 40px) !important;
    height:48px !important;
    min-height:48px !important;
    padding:0 !important;
    margin:0 !important;
    background:transparent !important;
    border:0 !important;
    box-shadow:none !important;
    pointer-events:none !important;
  }
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] > .msi-portal-detail-1690__actions > button {
    position:relative !important;
    inset:auto !important;
    top:auto !important;
    right:auto !important;
    bottom:auto !important;
    left:auto !important;
    transform:none !important;
    flex:0 0 auto !important;
    display:inline-flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:8px !important;
    width:max-content !important;
    min-width:0 !important;
    max-width:100% !important;
    height:48px !important;
    min-height:48px !important;
    max-height:48px !important;
    padding:0 18px !important;
    margin:0 !important;
    border:0 !important;
    border-radius:999px !important;
    background:#fff !important;
    color:#142b45 !important;
    font-size:14px !important;
    font-weight:700 !important;
    line-height:1.2 !important;
    white-space:nowrap !important;
    opacity:1 !important;
    visibility:visible !important;
    overflow:visible !important;
    box-shadow:0 8px 20px rgba(15,23,42,.16) !important;
    pointer-events:auto !important;
    cursor:pointer !important;
  }
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] > .msi-portal-detail-1690__actions > button > i {
    font-size:18px !important;
    flex:0 0 auto !important;
  }
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] .msi-photo-label-mobile {display:none !important;}
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] .msi-photo-label-desktop {display:inline !important;}
}
/* Mobile: mantém 350px e os dois botões iguais na base (versão 16.1.93). */
@media (max-width:820px) {
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] .msi-photo-label-mobile {display:inline !important;}
  body.msi-portal-property-v2 section.msi-portal-detail__gallery[data-portal-gallery-wrap] .msi-photo-label-desktop {display:none !important;}
}

/* Galeria acessível caso Fancybox não esteja disponível. */
body.msi-gallery-is-open-1694{overflow:hidden !important;}
.msi-gallery-fallback-1694{
  position:fixed;inset:0;z-index:2147483000;display:flex;align-items:center;justify-content:center;
  background:rgba(4,12,22,.95);padding:56px 15px 70px;box-sizing:border-box;
}
.msi-gallery-fallback-1694 img{width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;}
.msi-gallery-fallback-1694 button{position:absolute;display:flex;align-items:center;justify-content:center;
  background:#fff;color:#132c45;border:0;border-radius:50%;width:44px;height:44px;font-size:30px;cursor:pointer;}
.msi-gallery-fallback-1694 button[aria-label="Fechar galeria"]{right:16px;top:12px;}
.msi-gallery-fallback-1694 button[aria-label="Foto anterior"]{left:12px;top:50%;transform:translateY(-50%);}
.msi-gallery-fallback-1694 button[aria-label="Próxima foto"]{right:12px;top:50%;transform:translateY(-50%);}
.msi-gallery-fallback-1694 > span{position:absolute;bottom:20px;left:0;right:0;text-align:center;color:#fff;font-weight:700;}
