/* Mandrake Grifes V24 — camada final de experiência e responsividade */
:root {
  --mg24-blue: #0865f5;
  --mg24-blue-dark: #0649b8;
  --mg24-ink: #101828;
  --mg24-muted: #667085;
  --mg24-line: #d9e2ef;
  --mg24-soft: #f4f7fb;
  --mg24-success: #087a55;
  --mg24-safe-bottom: 18px;
  --mg24-header-height: 64px;
  --mg24-radius-sm: 12px;
  --mg24-radius: 18px;
  --mg24-radius-lg: 24px;
  --mg24-shadow: 0 14px 38px rgba(16, 24, 40, .08);
}

html { scroll-padding-top: calc(var(--mg24-header-height) + 16px); }
body { color: var(--mg24-ink); background: #f5f7fb; }
body :is(h1,h2,h3,h4) { text-wrap: balance; }
body :is(p,small) { text-wrap: pretty; }

/* Cabeçalho, menu e camadas fixas */
.mg-header-inicio,
.mg-cart-header,
header.mg-header-inicio {
  min-height: var(--mg24-header-height) !important;
  height: var(--mg24-header-height) !important;
}
.mg-inicio-slide-menu,
#slide-menu-inicio,
#mg-shop-menu.mg-shop-menu { z-index: 4100 !important; }
.mg-inicio-overlay,
#menuOverlay { z-index: 4000 !important; }
body.mg24-interface-busy :is(#mgChatLauncher,#carrinhoFlutuante,.mg17-backtop) {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Home: produto primeiro, conteúdo editorial depois */
body:has(#produtosCarrossel) main.mg-main {
  display: flex !important;
  flex-direction: column !important;
  padding-top: calc(var(--mg24-header-height) + 8px) !important;
}
body:has(#produtosCarrossel) main.mg-main > section:has(#produtosCarrossel) { order: 1; }
body:has(#produtosCarrossel) main.mg-main > .mg-story-shell { order: 2; }
body:has(#produtosCarrossel) main.mg-main > section:has(.mg-fashion-trust) { order: 3; }

.mg-products-panel,
.mg-story-card {
  border: 1px solid var(--mg24-line) !important;
  box-shadow: var(--mg24-shadow) !important;
  background: #fff !important;
}
.mg-products-panel { padding: clamp(16px, 2vw, 28px) !important; }
.mg-products-panel > div:first-child { margin-bottom: 18px !important; }
.mg-products-heading { color: var(--mg24-ink) !important; letter-spacing: -.04em !important; }

#produtosCarrossel {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 16px !important;
  overflow: visible !important;
  padding: 0 !important;
}
#produtosCarrossel > .produto-card {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  border: 1px solid var(--mg24-line) !important;
  border-radius: var(--mg24-radius) !important;
  background: #fff !important;
  box-shadow: 0 8px 22px rgba(16,24,40,.055) !important;
}
#produtosCarrossel > .produto-card > .relative {
  height: auto !important;
  min-height: 0 !important;
  aspect-ratio: 4 / 5 !important;
  background: #eef2f6 !important;
}
#produtosCarrossel .produto-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center top !important;
}
#produtosCarrossel .produto-price-box {
  min-height: 0 !important;
  margin-bottom: 10px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#produtosCarrossel .produto-price-box span.rounded-full {
  color: #08603f !important;
  background: #ecfdf3 !important;
  border: 1px solid #b7ebcf !important;
}
#produtosCarrossel .produto-price-box .text-3xl { font-size: 22px !important; }
#produtosCarrossel .opcoes { max-height: 42px; overflow: auto; scrollbar-width: none; }
#produtosCarrossel .flex.gap-3 { margin-top: auto !important; }
#prevBtn,#nextBtn { display: none !important; }

.mg-story-shell { padding-top: 16px !important; }
.mg-story-card .mg-story-empty-inner { padding: 18px !important; }
.mg-story-content-box { padding: 10px !important; }
.mg-fashion-trust { gap: 10px !important; }
.mg-fashion-trust-item {
  min-height: 84px !important;
  padding: 12px !important;
  border-color: var(--mg24-line) !important;
  border-radius: var(--mg24-radius) !important;
  box-shadow: none !important;
}

/* Catálogo: busca primeiro e produtos mais cedo */
.mg-store { width: min(100% - 24px, 1440px) !important; padding-top: calc(var(--mg24-header-height) + 12px) !important; }
.mg-hero-pro {
  padding: 18px 20px !important;
  border-color: var(--mg24-line) !important;
  border-radius: var(--mg24-radius-lg) !important;
  box-shadow: var(--mg24-shadow) !important;
}
.mg-hero-pro h1 { margin: 4px 0 6px !important; font-size: clamp(28px, 4vw, 44px) !important; }
.mg-hero-pro p { max-width: 760px !important; margin-bottom: 10px !important; }
.mg-hero-status-card { min-width: 150px !important; padding: 14px !important; }
.mg-trust-strip { margin-block: 10px !important; }
.mg-filter-panel {
  margin-top: 10px !important;
  padding: 14px !important;
  border: 1px solid var(--mg24-line) !important;
  border-radius: var(--mg24-radius) !important;
  box-shadow: 0 8px 24px rgba(16,24,40,.05) !important;
}
.mg-product-filter-grid { grid-template-columns: minmax(260px, 1.5fr) repeat(3,minmax(160px,.7fr)) !important; }
.js-products-grid { align-items: stretch !important; gap: 14px !important; }
.js-product-card {
  border-radius: var(--mg24-radius) !important;
  border-color: var(--mg24-line) !important;
  box-shadow: 0 7px 22px rgba(16,24,40,.05) !important;
}
.js-product-card .mg-product-image-wrap { aspect-ratio: 4 / 5 !important; }
.js-product-card .imagem-produto { object-position: center top !important; }
.js-product-card .mg-price-box { box-shadow: none !important; }
.mg-card-actions { gap: 8px !important; }

/* Produto dedicado */
.mg-product-detail-main { padding-top: calc(var(--mg24-header-height) + 16px) !important; }
.mg-product-detail-main .mg-client-card { border-color: var(--mg24-line) !important; box-shadow: var(--mg24-shadow) !important; }
.mg-gallery-main {
  aspect-ratio: 4 / 5 !important;
  max-height: 680px;
  border-radius: var(--mg24-radius-lg) !important;
  background: #f0f3f7 !important;
}
.mg-gallery-main img { padding: 0 !important; object-fit: contain !important; }
.mg24-gallery-thumbs { display: flex; gap: 9px; overflow-x: auto; padding: 10px 2px 2px; scrollbar-width: thin; }
.mg24-gallery-thumb { width: 66px; height: 82px; flex: 0 0 auto; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 13px; background: #eef2f6; cursor: pointer; }
.mg24-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }
.mg24-gallery-thumb.is-active { border-color: var(--mg24-blue); box-shadow: 0 0 0 3px rgba(8,101,245,.12); }
.mg24-product-status { display: flex; flex-wrap: wrap; gap: 8px; }
.mg24-stock-pill { display: inline-flex; align-items: center; gap: 7px; padding: 8px 11px; border-radius: 999px; color: #08734b; background: #ecfdf3; border: 1px solid #b7ebcf; font-size: 12px; font-weight: 850; }
.mg24-stock-pill.is-out { color: #b42318; background: #fff1f0; border-color: #fecdca; }
.mg24-color-choice { padding: 9px 12px !important; }
.mg24-color-dot { width: 18px; height: 18px; display: inline-block; flex: 0 0 auto; border: 2px solid #fff; border-radius: 999px; box-shadow: 0 0 0 1px #aeb9c8; }
.choice { min-height: 44px; align-items: center; gap: 8px; }
.choice:focus-within { outline: 3px solid rgba(8,101,245,.2); outline-offset: 2px; }
.choice input { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none; }

/* Sacola */
.mg-checkout-clean { padding-top: calc(var(--mg24-header-height) + 12px) !important; }
.checkout-topbar,.checkout-card-pro,.checkout-summary-card { border-color: var(--mg24-line) !important; box-shadow: var(--mg24-shadow) !important; }
#listaCarrinho > .list-group-item { border-color: var(--mg24-line) !important; }
#listaCarrinho .item-img { width: 84px !important; height: 106px !important; border-radius: 14px !important; object-fit: cover !important; object-position: center top; }
#listaCarrinho .bg-primary-subtle { color: #08603f !important; background: #ecfdf3 !important; border-color: #b7ebcf !important; }
.mg-whatsapp-checkout-box { border-color: #9be0c1 !important; background: #f1fbf6 !important; }
.checkout-final-btn { background: #16a367 !important; border-color: #16a367 !important; }
#pixPagamentoModal { display: none !important; }

/* Favoritos e conta */
.favoritos-page .hero-panel,.favoritos-page .content-panel,
body.mg-client-page .mg-client-card,
body.mg-client-page .mg-dashboard-card { border-color: var(--mg24-line) !important; box-shadow: var(--mg24-shadow) !important; }
#favoritosGrid .produto-card { border-color: var(--mg24-line) !important; box-shadow: 0 7px 22px rgba(16,24,40,.05) !important; }
#favoritosGrid .produto-image { aspect-ratio: 4 / 5 !important; }
#favoritosGrid .produto-image img { object-position: center top !important; }
#favoritosGrid .produto-desc { display: none !important; }
body.mg-client-page .mg-dashboard-card.active { background: var(--mg24-blue) !important; }
body.mg-client-page #modalPagamentoPixPedido { display: none !important; }

/* Chat: útil sem dominar a tela */
#mgChatPanel { max-height: 72dvh !important; }
#mgChatLauncher { z-index: 1300 !important; }
#mgChatPanel { z-index: 1350 !important; }
html.mg20-chat-open #carrinhoFlutuante { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; }

/* Acessibilidade */
:is(a,button,input,select,textarea):focus-visible { outline: 3px solid rgba(8,101,245,.25) !important; outline-offset: 2px !important; }
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (max-width: 1100px) {
  #produtosCarrossel { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  .mg-product-filter-grid { grid-template-columns: 1.3fr repeat(2,minmax(160px,.8fr)) !important; }
  .mg-product-filter-grid > :last-child { display: none !important; }
}

@media (max-width: 760px) {
  :root { --mg24-safe-bottom: calc(76px + env(safe-area-inset-bottom,0px)); --mg24-header-height: 58px; }
  body:not(.mg-cart-page) { padding-bottom: calc(82px + env(safe-area-inset-bottom,0px)) !important; }
  body:has(#produtosCarrossel) main.mg-main { padding-top: calc(var(--mg24-header-height) + 6px) !important; }

  .mg-wide-shell { width: calc(100% - 12px) !important; }
  .mg-products-panel { padding: 14px !important; border-radius: 20px !important; }
  .mg-products-panel > div:first-child { margin-bottom: 13px !important; }
  .mg-products-heading { font-size: 27px !important; }
  .mg-products-panel p { font-size: 13px !important; line-height: 1.45 !important; }
  #produtosCarrossel {
    display: flex !important;
    gap: 11px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-left: 2px;
    padding: 2px 2px 12px !important;
    margin-inline: -2px !important;
    scrollbar-width: none;
  }
  #produtosCarrossel > .produto-card {
    flex: 0 0 min(82vw, 330px) !important;
    width: min(82vw,330px) !important;
    scroll-snap-align: start;
  }
  #produtosCarrossel > .produto-card > :is(.p-4,.p-5) { padding: 12px !important; }
  #produtosCarrossel .produto-nome { min-height: auto !important; font-size: 15px !important; }
  #produtosCarrossel .flex.gap-3 { grid-template-columns: 1fr 1.2fr !important; }

  .mg-story-shell { padding-top: 10px !important; }
  .mg-story-card .mg-story-empty-inner { padding: 14px !important; }
  .mg-story-logo { width: 44px !important; height: 44px !important; }
  .mg-story-title { margin-top: 4px !important; font-size: 22px !important; }
  .mg-story-desc { display: none !important; }
  .mg-fashion-trust { display: flex !important; overflow-x: auto !important; gap: 8px !important; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .mg-fashion-trust-item { min-width: 78vw !important; min-height: 74px !important; scroll-snap-align: start; }

  .mg-store { width: calc(100% - 10px) !important; padding-top: calc(var(--mg24-header-height) + 8px) !important; }
  .mg-hero-pro { padding: 14px !important; border-radius: 18px !important; }
  .mg-hero-pro h1 { font-size: 29px !important; }
  .mg-hero-pro p { font-size: 13px !important; line-height: 1.45 !important; }
  .mg-hero-status-card { display: none !important; }
  .mg-hero-actions { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .mg-hero-cta { min-height: 43px !important; padding: 9px !important; font-size: 12px !important; }
  .mg-trust-strip { display: none !important; }
  .mg-filter-panel { margin-inline: 0 !important; padding: 12px !important; border-radius: 18px !important; }
  .mg-product-filter-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .mg-product-filter-grid > .mg-search-wrap { grid-column: 1 / -1 !important; }
  .mg-product-filter-grid > :last-child { display: none !important; }
  .mg-input-pro { height: 46px !important; border-radius: 14px !important; }
  .js-products-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 9px !important; }
  .js-product-card { border-radius: 15px !important; }
  .js-product-card .flex.flex-1.flex-col { padding: 9px !important; }
  .js-product-card .js-description,.js-product-card .js-desc-toggle { display: none !important; }
  .js-product-card h3 { font-size: 13px !important; line-height: 1.25 !important; }
  .js-product-card .mg-card-meta-row { gap: 4px !important; }
  .js-product-card .mg-card-availability { display: none !important; }
  .js-product-card .mg-card-actions { grid-template-columns: 1fr !important; }
  .js-product-card .mg-card-actions > :is(a,button) { min-height: 40px !important; font-size: 11px !important; }

  .mg-product-detail-main { padding: calc(var(--mg24-header-height) + 8px) 8px 110px !important; }
  .mg-product-breadcrumb { padding-inline: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mg-gallery-main { max-height: 66dvh; border-radius: 18px !important; }
  .mg24-gallery-thumb { width: 58px; height: 72px; }
  .mg-product-detail-main .mg-client-title { font-size: 28px !important; }
  .mg-product-actions.two { grid-template-columns: 1fr !important; }
  .mg-client-sticky-buy { left: 7px !important; right: 7px !important; bottom: calc(70px + env(safe-area-inset-bottom,0px)) !important; gap: 7px !important; z-index: 1250 !important; }

  .mg-checkout-clean { padding: calc(var(--mg24-header-height) + 8px) 6px 105px !important; }
  .checkout-topbar { padding: 14px !important; }
  #listaCarrinho > .list-group-item { padding: 12px 9px !important; }
  #listaCarrinho > .list-group-item > .d-flex { gap: 9px !important; align-items: flex-start; }
  #listaCarrinho .item-img { width: 76px !important; height: 96px !important; }
  #listaCarrinho .flex-grow-1 { min-width: 0; }
  #listaCarrinho h6 { font-size: 13px !important; line-height: 1.3 !important; }
  #listaCarrinho .mg18-cart-meta { display: flex !important; flex-direction: column !important; gap: 2px !important; }
  #listaCarrinho .bg-primary-subtle { margin-top: 7px !important; padding: 7px !important; font-size: 10px !important; }
  .checkout-mobile-bar { z-index: 1250 !important; }

  #favoritosGrid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 9px !important; }
  #favoritosGrid .produto-info { padding: 9px !important; }
  #favoritosGrid .produto-meta { display: none !important; }
  #favoritosGrid .btn-group { grid-template-columns: 1fr !important; }
  #favoritosGrid .btn-remover { display: none !important; }
  #favoritosGrid .produto-info h3 { font-size: 13px !important; }

  body.mg-client-page .mg-dashboard-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }
  body.mg-client-page .mg-dashboard-card { min-height: 92px !important; padding: 11px !important; }
  body.mg-client-page .mg-v31-account-hub .mg-client-grid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; }

  #mgChatPanel { top: auto !important; bottom: calc(72px + env(safe-area-inset-bottom,0px)) !important; height: min(70dvh,560px) !important; min-height: 340px !important; }
  #mgChatLauncher { bottom: calc(76px + env(safe-area-inset-bottom,0px)) !important; }
  #carrinhoFlutuante.mg-floating-cart { bottom: calc(76px + env(safe-area-inset-bottom,0px)) !important; }
}

@media (max-width: 380px) {
  #produtosCarrossel > .produto-card { flex-basis: 86vw !important; width: 86vw !important; }
  .js-products-grid { gap: 7px !important; }
  .mg-product-filter-grid { grid-template-columns: 1fr !important; }
  .mg-product-filter-grid > * { grid-column: 1 !important; }
  body.mg-client-page .mg-dashboard-grid { grid-template-columns: 1fr !important; }
}
