/* Mandrake Grifes V13 — refinamento final do storefront. Escopo deliberadamente específico. */
:root{
  --mg13-blue:#0b63f6;
  --mg13-blue-dark:#0849b8;
  --mg13-blue-soft:#eff6ff;
  --mg13-ink:#101828;
  --mg13-muted:#667085;
  --mg13-line:#dbe7f6;
  --mg13-bg:#f6f8fc;
  --mg13-card:#fff;
  --mg13-radius:18px;
  --mg13-shadow:0 12px 34px rgba(16,24,40,.08);
  --mg13-header:60px;
  --mg13-bottom:64px;
}
html{overflow-x:hidden;background:var(--mg13-bg)}
body{overflow-x:hidden;background:var(--mg13-bg)!important;color:var(--mg13-ink)!important;-webkit-font-smoothing:antialiased}
body.menu-open,html.menu-open{overflow:hidden!important}

/* Cabeçalho único */
.mg-header-inicio{position:sticky!important;top:0!important;z-index:9000!important;min-height:var(--mg13-header)!important;background:rgba(255,255,255,.96)!important;border-bottom:1px solid var(--mg13-line)!important;box-shadow:0 4px 18px rgba(16,24,40,.06)!important;backdrop-filter:blur(14px)!important}
.mg-header-inicio-inner{width:min(100% - 20px,1440px)!important;min-height:var(--mg13-header)!important;padding:8px 0!important}
.mg-inicio-logo-card{min-height:42px!important;padding:5px 11px 5px 6px!important;border-radius:14px!important;border:1px solid #cfe0f8!important;background:#fff!important;box-shadow:none!important}
.mg-inicio-logo-img{width:32px!important;height:32px!important;border-radius:10px!important}
.mg-inicio-logo-title{font-size:.86rem!important;font-weight:900!important;color:var(--mg13-ink)!important}
.mg-inicio-menu-button{width:42px!important;height:42px!important;min-height:42px!important;border-radius:14px!important;border:1px solid #cfe0f8!important;background:#fff!important;color:var(--mg13-blue)!important;box-shadow:none!important}

/* Drawer sempre fechado até ação explícita do usuário */
.mg-inicio-overlay{position:fixed!important;inset:0!important;z-index:9997!important;background:rgba(15,23,42,.48)!important;opacity:0!important;visibility:hidden!important;pointer-events:none!important;transition:opacity .2s ease,visibility .2s ease!important}
.mg-inicio-overlay:not(.mg-inicio-hidden){opacity:1!important;visibility:visible!important;pointer-events:auto!important}
.mg-inicio-slide-menu{position:fixed!important;top:0!important;right:0!important;bottom:0!important;z-index:9999!important;width:min(88vw,390px)!important;height:100dvh!important;transform:translateX(105%)!important;visibility:hidden!important;pointer-events:none!important;background:#fff!important;color:var(--mg13-ink)!important;border-left:1px solid var(--mg13-line)!important;border-radius:0!important;box-shadow:-24px 0 70px rgba(15,23,42,.24)!important;overflow-y:auto!important;transition:transform .24s cubic-bezier(.2,.8,.2,1),visibility .24s ease!important}
.mg-inicio-slide-menu.open{transform:translateX(0)!important;visibility:visible!important;pointer-events:auto!important}
.mg-inicio-menu-header{position:sticky!important;top:0!important;z-index:2!important;padding:18px 16px!important;background:#fff!important;border-bottom:1px solid var(--mg13-line)!important;color:var(--mg13-ink)!important}
.mg-inicio-menu-list{display:grid!important;gap:8px!important;padding:14px!important}
.mg-inicio-menu-item{min-height:52px!important;padding:11px 13px!important;border-radius:14px!important;border:1px solid var(--mg13-line)!important;background:#fff!important;color:var(--mg13-ink)!important;box-shadow:none!important;font-size:.95rem!important}
.mg-inicio-menu-item:hover{background:var(--mg13-blue-soft)!important;border-color:#bfd6fa!important}
.mg-inicio-cart-link{background:var(--mg13-blue)!important;color:#fff!important;border-color:var(--mg13-blue)!important}
.mg-inicio-logout{background:#fff5f5!important;color:#c62828!important;border-color:#fecaca!important}

/* Superfícies gerais */
.brand-panel,.hero-panel,.content-panel,.mg-client-card,.mg-client-hero,.checkout-card-pro{border:1px solid var(--mg13-line)!important;background:#fff!important;border-radius:var(--mg13-radius)!important;box-shadow:0 6px 24px rgba(16,24,40,.055)!important}
h1,h2,h3{color:var(--mg13-ink)!important;letter-spacing:-.035em}
p{color:var(--mg13-muted)}

/* Botões apenas por classes conhecidas */
.brand-button,.mg-primary-btn,.mg-home-entry-btn.primary,.mg-detail-btn.primary,.btn-primary,.checkout-final-button,.cart-primary-action{
  min-height:44px!important;border-radius:12px!important;background:var(--mg13-blue)!important;color:#fff!important;border:1px solid var(--mg13-blue)!important;box-shadow:0 8px 20px rgba(11,99,246,.18)!important;font-weight:850!important
}
.brand-outline-button,.mg-home-entry-btn:not(.primary),.mg-detail-btn,.btn-outline-primary,.btn-secondary{
  min-height:44px!important;border-radius:12px!important;background:#fff!important;color:var(--mg13-blue-dark)!important;border:1px solid #bfd6fa!important;box-shadow:none!important;font-weight:800!important
}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid rgba(11,99,246,.24)!important;outline-offset:2px!important}

/* HOME: hero, stories e destaques */
.mg-home-entry-card{border-radius:22px!important;background:linear-gradient(135deg,#fff 0%,#f5f9ff 68%,#e7f1ff 100%)!important;border:1px solid var(--mg13-line)!important;box-shadow:var(--mg13-shadow)!important}
.mg-story-card{padding:20px!important;border-radius:22px!important;background:linear-gradient(135deg,#fff,#f5f9ff)!important;border:1px solid var(--mg13-line)!important}
.mg-story-content-box{min-height:112px!important;padding:16px!important;background:#fff!important;border:1px solid var(--mg13-line)!important;border-radius:16px!important}
.mg-products-panel{padding:26px!important;overflow:hidden!important}
.mg-products-panel .produto-card{flex:0 0 250px!important;width:250px!important;min-width:250px!important;border:1px solid var(--mg13-line)!important;border-radius:18px!important;background:#fff!important;box-shadow:0 8px 24px rgba(16,24,40,.07)!important;overflow:hidden!important}
.mg-products-panel .produto-card .produto-img{width:100%!important;height:285px!important;object-fit:cover!important}
.mg-products-panel .produto-card .produto-price-box{background:#f8fbff!important;border:1px solid #d8e7fb!important;border-radius:14px!important}
.mg-products-panel .produto-card button,.mg-products-panel .produto-card a[class*="btn"]{min-height:42px!important;border-radius:11px!important}

/* CATÁLOGO: quatro colunas reais no desktop, duas no celular */
#mgUnifiedGrid,.js-products-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:16px!important}
.js-product-card.mg-product-card{min-width:0!important;width:100%!important;border:1px solid var(--mg13-line)!important;border-radius:18px!important;background:#fff!important;box-shadow:0 7px 22px rgba(16,24,40,.06)!important;overflow:hidden!important;transform:none!important}
.js-product-card.mg-product-card:hover{transform:translateY(-2px)!important;box-shadow:0 14px 32px rgba(16,24,40,.10)!important}
.js-product-card .mg-product-image-wrap{aspect-ratio:4/5!important;background:#f3f6fb!important}
.js-product-card .imagem-produto{width:100%!important;height:100%!important;object-fit:cover!important}
.js-product-card .js-description{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important}
.js-product-card .mg-primary-btn,.js-product-card .mg-detail-btn{min-height:42px!important;border-radius:11px!important;font-size:.82rem!important}
.mg-product-filter-grid{gap:12px!important}
.mg-product-filter-grid input,.mg-product-filter-grid select{min-height:46px!important;border-radius:12px!important;border:1px solid #cbdcf2!important;background:#fff!important;font-size:16px!important}

/* FAVORITOS */
#favoritosGrid.produtos-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:16px!important}
#favoritosGrid .produto-card{width:100%!important;min-width:0!important;border:1px solid var(--mg13-line)!important;border-radius:18px!important;background:#fff!important;box-shadow:0 7px 22px rgba(16,24,40,.06)!important;overflow:hidden!important}
#favoritosGrid .produto-card img{width:100%!important;aspect-ratio:4/5!important;object-fit:cover!important}
#favoritosGrid .produto-card .produto-desc{display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important}
#favoritosGrid .produto-card .acoes-produto,#favoritosGrid .produto-card .product-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:8px!important}

/* CARRINHO */
.mg-cart-page{background:var(--mg13-bg)!important}
.mg-cart-header{background:#fff!important;border-bottom:1px solid var(--mg13-line)!important;box-shadow:0 4px 18px rgba(16,24,40,.05)!important}
.mg-cart-page .checkout-layout,.mg-cart-page .checkout-grid,.mg-cart-page .cart-checkout-layout{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(310px,370px)!important;gap:18px!important;align-items:start!important}
.mg-cart-page .checkout-summary-card{position:sticky!important;top:76px!important}
.mg-cart-page .cart-items-card,.mg-cart-page .checkout-summary-card{border-radius:18px!important;border:1px solid var(--mg13-line)!important;box-shadow:0 7px 24px rgba(16,24,40,.06)!important}
.mg-cart-page .item-carrinho,.mg-cart-page .cart-item-row{border-bottom:1px solid #edf1f7!important;padding:14px!important}
.mg-cart-page .discount-box,.mg-cart-page [class*="discount"]{border-radius:12px!important}

/* Navegação inferior: somente mobile */
.mg-v8-bottom-nav,.mg-v7-bottom-nav,.mg-v6-bottom-nav,.mg-bottom-nav,.mobile-bottom-nav,.bottom-nav{display:none!important}

/* Widget IA acima da barra, sem afetar elementos internos */
iframe[title*="chat" i],iframe[src*="agent-factory" i],iframe[src*="chat" i],[data-agent-chat]{z-index:9700!important}

@media(max-width:1100px){
  #mgUnifiedGrid,.js-products-grid,#favoritosGrid.produtos-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .mg-cart-page .checkout-layout,.mg-cart-page .checkout-grid,.mg-cart-page .cart-checkout-layout{grid-template-columns:1fr!important}
  .mg-cart-page .checkout-summary-card{position:static!important}
}

@media(max-width:768px){
  body{padding-bottom:calc(var(--mg13-bottom) + 18px + env(safe-area-inset-bottom))!important;background:#fff!important}
  .mg-header-inicio-inner{width:calc(100% - 16px)!important}
  .mg-inicio-slide-menu{width:min(88vw,360px)!important}
  .mg-home-entry-card,.mg-story-card,.mg-products-panel,.hero-panel,.content-panel,.mg-client-card,.mg-client-hero{border-radius:16px!important}
  .mg-home-entry-card{padding:18px!important}
  .mg-story-card{padding:14px!important}
  .mg-story-content-box{min-height:90px!important;padding:12px!important}
  .mg-products-panel{padding:16px!important}
  .mg-products-panel .produto-card{flex:0 0 74vw!important;width:74vw!important;min-width:74vw!important;max-width:310px!important}
  .mg-products-panel .produto-card .produto-img{height:330px!important}
  #mgUnifiedGrid,.js-products-grid,#favoritosGrid.produtos-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .js-product-card.mg-product-card,#favoritosGrid .produto-card{border-radius:14px!important}
  .js-product-card .mg-product-image-wrap,#favoritosGrid .produto-card img{aspect-ratio:3/4!important}
  .js-product-card .js-description,#favoritosGrid .produto-card .produto-desc{display:none!important}
  .js-product-card .mg-primary-btn,.js-product-card .mg-detail-btn{font-size:.76rem!important;padding:8px 6px!important}
  #favoritosGrid .produto-card .acoes-produto,#favoritosGrid .produto-card .product-actions{grid-template-columns:1fr!important}
  .mg-cart-page .item-carrinho,.mg-cart-page .cart-item-row{padding:10px!important}
  .mg-v8-bottom-nav,.mg-v7-bottom-nav,.mg-v6-bottom-nav,.mg-bottom-nav,.mobile-bottom-nav,.bottom-nav{display:flex!important;position:fixed!important;left:8px!important;right:8px!important;bottom:calc(6px + env(safe-area-inset-bottom))!important;width:auto!important;height:var(--mg13-bottom)!important;min-height:var(--mg13-bottom)!important;padding:4px!important;border-radius:16px!important;background:rgba(255,255,255,.98)!important;border:1px solid var(--mg13-line)!important;box-shadow:0 14px 36px rgba(16,24,40,.16)!important;z-index:9500!important}
  .mg-v8-bottom-nav a,.mg-v7-bottom-nav a,.mg-v6-bottom-nav a,.mg-bottom-nav a,.mobile-bottom-nav a,.bottom-nav a{min-width:0!important;min-height:54px!important;border-radius:12px!important;font-size:.66rem!important;color:#536176!important}
  iframe[title*="chat" i],iframe[src*="agent-factory" i],iframe[src*="chat" i],[data-agent-chat]{position:fixed!important;right:10px!important;bottom:calc(var(--mg13-bottom) + 18px + env(safe-area-inset-bottom))!important;z-index:9700!important;max-width:calc(100vw - 20px)!important}
}

@media(max-width:390px){
  #mgUnifiedGrid,.js-products-grid,#favoritosGrid.produtos-grid{gap:8px!important}
  .mg-products-panel .produto-card{flex-basis:82vw!important;width:82vw!important;min-width:82vw!important}
  .mg-inicio-logo-title{font-size:.78rem!important}
}

@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* =========================================================
   V14 — refinamento visual focado em Home e vitrine
   ========================================================= */
.mg-main{padding-top:18px!important}
.mg-home-entry-shell{margin-top:0!important}
.mg-home-entry-hero{margin-top:0!important}
.mg-story-shell{padding-top:18px!important}
.mg-fashion-trust{margin-top:0!important}

/* Remove resquícios do bloco de cupom da Home caso cache antigo injete marcação */
.mg-coupon-card,.coupon-scroll{display:none!important}

/* Destaques: grade estável, sem cards cortados ou carrossel deformado */
.mg-products-panel{overflow:visible!important}
#produtosCarrossel{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:16px!important;
  overflow:visible!important;
  padding-bottom:0!important;
  scroll-snap-type:none!important;
}
.mg-products-panel .produto-card{
  width:auto!important;
  min-width:0!important;
  max-width:none!important;
  flex:none!important;
  border-radius:18px!important;
  display:flex!important;
  flex-direction:column!important;
  min-height:100%!important;
}
.mg-products-panel .produto-card>div:last-child{display:flex!important;flex-direction:column!important;flex:1!important;padding:14px!important}
.mg-products-panel .produto-card .produto-img{height:240px!important;aspect-ratio:1/1!important;object-fit:cover!important;background:#f4f7fb!important}
.mg-products-panel .produto-card .produto-nome{font-size:16px!important;line-height:1.25!important;margin-bottom:8px!important;color:#111827!important;background:transparent!important;padding:0!important}
.mg-products-panel .produto-card .produto-price-box{font-size:24px!important;line-height:1.1!important;margin-bottom:10px!important;padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important}
.mg-products-panel .produto-card .flex.text-yellow-400{font-size:14px!important}
.mg-products-panel .produto-card .opcoes{gap:7px!important}
.mg-products-panel .produto-card .opcao-tamanho{min-width:36px!important;min-height:34px!important;padding:6px 10px!important;border-radius:10px!important}
.mg-products-panel .produto-card .opcao-cor{width:32px!important;height:32px!important}
.mg-products-panel .produto-card .flex.gap-3{margin-top:auto!important;gap:8px!important}
.mg-products-panel .produto-card .flex.gap-3>a,
.mg-products-panel .produto-card .flex.gap-3>button{min-height:44px!important;padding:10px 8px!important;border-radius:12px!important;font-size:13px!important}
#prevBtn,#nextBtn{display:none!important}

/* Stories e benefícios mais compactos */
.mg-story-card{margin-top:0!important}
.mg-story-content-box{min-height:auto!important}
.mg-fashion-trust-item{padding:12px!important;border-radius:16px!important;box-shadow:none!important}

@media (max-width:1100px){
  #produtosCarrossel{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media (max-width:760px){
  .mg-main{padding-top:12px!important}
  .mg-wide-shell{width:calc(100% - 16px)!important;margin-left:auto!important;margin-right:auto!important}
  .mg-home-entry-shell{margin-top:0!important}
  .mg-home-entry-hero{padding:18px!important}
  .mg-home-entry-title{font-size:28px!important;line-height:1.05!important}
  .mg-home-entry-sub{font-size:14px!important;line-height:1.5!important}
  .mg-story-shell{padding-top:12px!important}
  .mg-story-card{border-radius:18px!important}
  .mg-story-empty-inner{padding:16px!important}
  .mg-story-desc{display:none!important}
  .mg-products-panel{padding:16px 12px!important;border-radius:18px!important}
  .mg-products-panel .mg-products-heading{font-size:25px!important;line-height:1.1!important}
  .mg-products-panel .mg-products-heading + p{font-size:13px!important;line-height:1.45!important;margin-top:8px!important}
  #produtosCarrossel{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .mg-products-panel .produto-card{border-radius:15px!important}
  .mg-products-panel .produto-card .produto-img{height:auto!important;aspect-ratio:1/1.15!important}
  .mg-products-panel .produto-card>div:last-child{padding:11px!important}
  .mg-products-panel .produto-card .produto-nome{font-size:14px!important;min-height:35px!important}
  .mg-products-panel .produto-card .produto-price-box{font-size:20px!important}
  .mg-products-panel .produto-card .flex.items-center.gap-2.mb-4{margin-bottom:10px!important;gap:5px!important;align-items:flex-start!important;flex-direction:column!important}
  .mg-products-panel .produto-card .flex.text-yellow-400{font-size:12px!important;white-space:nowrap!important}
  .mg-products-panel .produto-card .flex.items-center.gap-2.mb-4 span{font-size:11px!important}
  .mg-products-panel .produto-card .mb-3,.mg-products-panel .produto-card .mb-4{margin-bottom:10px!important}
  .mg-products-panel .produto-card .opcoes{gap:5px!important}
  .mg-products-panel .produto-card .opcao-tamanho{min-width:32px!important;min-height:31px!important;padding:5px 7px!important;font-size:11px!important}
  .mg-products-panel .produto-card .opcao-cor{width:29px!important;height:29px!important}
  .mg-products-panel .produto-card .flex.gap-3{display:grid!important;grid-template-columns:1fr!important;gap:7px!important}
  .mg-products-panel .produto-card .flex.gap-3>a,
  .mg-products-panel .produto-card .flex.gap-3>button{width:100%!important;min-height:40px!important;padding:8px 5px!important;font-size:12px!important}
  .mg-fashion-trust{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:6px!important}
  .mg-fashion-trust-item{display:flex!important;align-items:center!important;justify-content:center!important;text-align:center!important;padding:9px 5px!important;min-height:72px!important}
  .mg-fashion-trust-icon{width:30px!important;height:30px!important;border-radius:9px!important}
  .mg-fashion-trust-item strong{font-size:10px!important}
  .mg-fashion-trust-item span:last-child span{display:none!important}
}
@media (max-width:380px){
  #produtosCarrossel{grid-template-columns:1fr!important}
  .mg-products-panel .produto-card .produto-img{aspect-ratio:1/1!important}
}
