/* ==========================================================================
   Clone Mercado Livre mobile — styles.css
   Todos os valores foram MEDIDOS do site real (Chrome headless, iPhone 12,
   dpr 3) e estão em reference/tokens.md. Nada aqui é estimativa.
   ========================================================================== */

/* ---------- fontes self-hosted (nunca hotlink do CDN do ML) ---------- */
@font-face {
  font-family: 'Proxima Nova';
  src: url('fonts/proxima-nova-300.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Proxima Nova';
  src: url('fonts/proxima-nova-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Proxima Nova';
  src: url('fonts/proxima-nova-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Proxima Nova';
  src: url('fonts/proxima-nova-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
/* fonte de ícones do header (mesma do ML: navigation.woff2) */
@font-face {
  font-family: 'navigation';
  src: url('fonts/navigation.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: block;
}

/* ---------- tokens medidos ---------- */
:root {
  --ml-yellow: #FFF159;        /* header (medido: rgb(255,241,89)) */
  --ml-yellow-badge: #FFE600;  /* marca/pílulas de destaque */
  --ml-blue: #3483FA;          /* ação universal (medido) */
  --ml-blue-soft: rgba(65, 137, 230, .15); /* botão secundário "adicionar ao carrinho" */
  --ml-blue-hover: #2968C8;
  --ml-green: #00A650;         /* benefício, frete grátis, desconto */
  --ml-orange: #FF7733;        /* selo MAIS VENDIDO */
  --ml-red: #F23D4F;           /* erro / recusa */
  --ml-wordmark: #2D3277;

  --ink: rgba(0, 0, 0, .9);
  --ink-2: rgba(0, 0, 0, .55);
  --ink-3: #666;
  --ink-4: #999;
  --cp-ink: #736C28;           /* linha "Enviar para" do header */

  --surface: #FFF;
  --page: #EDEDED;             /* fundo da página (medido: rgb(237,237,237)) */
  --surface-2: #F5F5F5;
  --line: #E0E0E0;
  --track: #EEE;

  --r-btn: 6px;                /* medido: 6px em botões e cards */
  --r-badge: 2px;
  --r-pill: 999px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .1);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .16);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-6: 24px;
  --tap: 48px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------- reset / globais obrigatórios ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  /* declarar explicitamente: se ficar sem valor, o Chrome herda o overflow-x do body
     por propagação e o gesto de dedo para de rolar a página */
  overflow-x: visible;
  /* ATENÇÃO: nada de overflow-x:hidden aqui. Com overflow-x:hidden no html E no body,
     o gesto de dedo não rola a página (o window.scrollTo ainda rola, o que engana o QA).
     Medido: 0px rolados com o bug, 705px sem ele. O clipping horizontal fica no body. */
}
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: 'Proxima Nova', -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--ml-blue); text-decoration: none; }
button, input, select, textarea {
  font-family: inherit; font-size: inherit; color: inherit;
  -webkit-appearance: none; appearance: none;
}
button { background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, p, ul, ol, li, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--ml-blue); outline-offset: 2px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* scrollbar invisível, inclusive nos carrosséis */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ==========================================================================
   HEADER (87px: 48 de linha + 39 da linha de CEP) — medida exata do real
   ========================================================================== */
.nav {
  position: sticky; top: 0; z-index: 900;
  background: var(--ml-yellow);
  padding-top: var(--safe-t);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .06);
}
.nav__bounds { position: relative; height: 48px; }  /* 48 + 39 da linha de CEP = 87 do header real */
.nav__logo {
  position: absolute; left: 10px; top: 8px;
  width: 44px; height: 32px;
  background: url('img/logo.png') no-repeat center / 44px 32px;
  font-size: 0; color: transparent;
}
.nav__search {
  position: absolute; left: 64px; top: 0; width: 232px; height: 48px;
  padding: 7px 0; z-index: 10;
}
.nav__search-input {
  width: 100%; height: 34px;
  padding: 5px 6px 7px 35px;
  border: 0; border-radius: 2px;
  background: #FFF; color: #333;
  font-size: 16px; font-weight: 400; line-height: 22px;
  box-shadow: var(--shadow);
}
.nav__search-input::placeholder { color: #999; }
.nav__search-btn {
  position: absolute; left: -6px; top: 0; width: 48px; height: 48px;
  color: #AAA; font-family: 'navigation'; font-size: 13px; line-height: 48px;
  text-align: center; z-index: 11;
}
.nav__menu {
  position: absolute; left: 300px; top: 0; width: 45px; height: 48px; z-index: 10;
}
.nav__menu span { position: absolute; left: 12px; width: 20px; height: 1px; background: #333; }
.nav__menu .h1 { top: 16px; }
.nav__menu .h2 { top: 23px; margin-top: -.67px; }
.nav__menu .h3 { top: 30px; margin-top: 6px; }
.nav__cart {
  position: absolute; left: 345px; top: 0; width: 45px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  color: #333; z-index: 10;
}
.nav__cart-icon { font-family: 'navigation'; font-size: 20px; line-height: 1; }
.nav__cart-badge {
  position: absolute; top: 6px; right: 4px;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--ml-blue); color: #FFF;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  border-radius: var(--r-pill);
  display: none;
}
.nav__cart.has-items .nav__cart-badge { display: block; }
/* linha "Enviar para" */
.nav__cp {
  position: relative; display: block; height: 39px; padding: 1px 30px 0 28px;
  color: var(--cp-ink); font-size: 13px; line-height: 38px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 0 0 rgba(0, 0, 0, .1);
}
.nav__cp:before {
  content: '\ea45'; font-family: 'navigation'; position: absolute;
  left: 10px; top: 0; font-size: 16px; line-height: 39px;
}
.nav__cp:after {
  content: ''; position: absolute; top: 16px; right: 12px;
  width: 5px; height: 5px; border-style: solid; border-width: 0 2px 2px 0;
  border-color: #C1B74D; transform: rotate(-45deg);
}

/* ==========================================================================
   TELAS / LAYOUT
   ========================================================================== */
.screen { display: none; }
.screen.is-active { display: block; }
.wrap { background: var(--surface); }
.pad { padding-left: 16px; padding-right: 16px; }
.sep { height: 1px; background: var(--line); margin: 0 16px; }

/* ==========================================================================
   T1 — PDP
   ========================================================================== */
.pdp { background: var(--surface); padding-bottom: 8px; }
.pdp__brand { display: flex; align-items: center; height: 35px; padding: 16px 16px 0; font-size: 14px; }
.pdp__state { padding: 16px 16px 0; }
.pdp__state-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 16px; margin-bottom: 8px; font-size: 12px; line-height: 1.35;
}
.pdp__subtitle { color: var(--ink-2); }
.pdp__rating { display: flex; align-items: center; color: var(--ink-2); }
.pdp__rating b { font-weight: 400; margin-right: 4px; }
.pdp__stars { display: flex; align-items: center; margin-right: 1px; }
.pdp__stars svg { width: 10px; height: 10px; margin-right: 3px; fill: var(--ml-blue); }
.pdp__amount { margin-left: 1px; color: var(--ink-2); }
.pdp__pill-row { display: flex; align-items: center; height: 16px; margin-bottom: 8px; gap: 8px; }
.pill-orange {
  display: inline-flex; align-items: center; height: 16px; padding: 3px 4px;
  background: var(--ml-orange); color: #FFF;
  font-size: 10px; font-weight: 600; line-height: 10px;
  border-radius: var(--r-badge); text-transform: uppercase;
}
.pdp__pill-link { font-size: 12px; }
.pdp__title {
  padding: 0 16px; font-size: 16px; font-weight: 400; line-height: 1.18;
  color: var(--ink);
}

/* galeria */
.gallery { position: relative; margin: 16px 0; }
.gallery__track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
}
.gallery__slide { flex: 0 0 100%; width: 100%; height: 312px; scroll-snap-align: start; }
.gallery__slide img { width: 100%; height: 100%; object-fit: contain; aspect-ratio: auto 500 / 500; padding: 16px; }  /* padding medido no real: a imagem é inset 16px */
.gallery__counter {
  position: absolute; left: 15px; top: 12px; width: 40px; height: 22px;
  background: var(--surface-2); color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 18.9px; text-align: center;
  border-radius: 12px; padding-top: 2px;
}
.gallery__counter .cur { }
.gallery__counter .tot { }
.circle-btn {
  position: absolute; width: 40px; height: 40px; right: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border-radius: 50%; color: var(--ink);
}
.circle-btn svg { width: 20px; height: 20px; }
.circle-btn--bookmark svg { fill: none; }  /* no real é contorno, não preenchido */
.circle-btn--bookmark { top: 16px; }
.circle-btn--share { top: 257px; }
.circle-btn--share svg { width: 20px; height: 20px; }
.dots {
  display: flex; align-items: center; justify-content: center;
  margin-top: 7px; height: 12px;
}
/* o ML mostra 4 pontos, com o ativo em azul e os seguintes encolhendo */
.dots li { width: 10px; height: 12px; margin: 0 4px; position: relative; cursor: pointer; }
.dots li:nth-child(3) { width: 8px; }
.dots li:nth-child(4) { width: 6px; }
.dots li::after {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 100%; height: 10px; border-radius: 50%; background: #D9D9D9;
}
.dots li:nth-child(3)::after { height: 8px; }
.dots li:nth-child(4)::after { height: 6px; }
.dots li.is-active::after { background: var(--ml-blue); }

.variations { padding: 0 16px 11px; }
.variations__title { font-size: 16px; font-weight: 400; margin-bottom: 8px; }
.variations__title b { font-weight: 600; }
.variations__items { display: flex; gap: 16px; }
.var-thumb {
  width: 88px; min-height: 164px; padding: 12px 9px;
  display: flex; flex-direction: column; align-items: center;
  border: 1px dashed var(--ink-2); border-radius: var(--r-btn);
  color: var(--ink); font-size: 12px; line-height: 1.35;
}
.var-thumb.is-selected { border: 2px solid var(--ml-blue); padding: 11px 8px; }
.var-thumb img { width: 64px; height: 64px; object-fit: contain; margin: 11px 0 5px; }
.var-thumb__price { font-size: 12px; font-weight: 600; line-height: 22px; }
.var-thumb__price { font-size: 12px; font-weight: 600; margin-top: 4px; }
.var-thumb__avail { color: var(--ink-2); font-size: 10px; line-height: 10px; }
.variations__items--chips { flex-wrap: wrap; }
.chip {
  padding: 8px 14px; border: 1px dashed var(--ink-2); border-radius: var(--r-btn);
  font-size: 12px; font-weight: 400; color: var(--ink); min-height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip.is-selected { border: 2px solid var(--ml-blue); padding: 7px 13px; }
.variations__group { margin-top: 24px; }
.variations__group .variations__title { margin-bottom: 8px; }

/* preço */
.price { margin-top: 16px; padding: 0 16px; }
.price__original {
  display: flex; align-items: baseline; padding-left: 16px; margin: 2px 0;
  color: var(--ink-2); font-size: 16px; line-height: 16px;
}
.price__original .fraction { text-decoration: line-through; }
.price__row { display: flex; align-items: center; gap: 4px; margin-top: 7px; }
.price__main { display: inline-flex; align-items: baseline; }
.price__main .currency { font-size: 16px; font-weight: 600; align-self: flex-start; line-height: 20px; margin-right: 20px; }
.price__main .fraction { font-size: 28px; font-weight: 600; line-height: 28px; }
.price__main .cents { font-size: 14px; font-weight: 600; margin: 3px 0 0 1px; line-height: 14px; }
/* o ML insere a vírgula dos centavos por CSS (andes-money-amount--cents-comma), não no texto */
.price__main .cents::before, .price__original .cents::before { content: ','; }
.badge-off {
  display: inline-flex; align-items: center; height: 18px; padding: 0 2px;
  background: var(--ml-green); color: #FFF;
  font-size: 14px; font-weight: 600; line-height: 18px; border-radius: var(--r-badge);
}
.price__pix { display: inline-flex; align-items: center; gap: 4px; color: var(--ml-green); font-size: 14px; font-weight: 600; }
.price__pix svg { width: 10px; height: 10px; fill: var(--ml-green); }
.price__installments { margin-top: 4px; font-size: 14px; color: var(--ink); }
.price__installments .g { color: var(--ml-green); }
.price__methods { margin-top: 0; font-size: 14px; }

/* buybox: frete, estoque, quantidade, ações */
.buybox { margin-top: 16px; padding: 0 16px; }
.ship { margin-bottom: 12px; }
.badge-green-pill {
  display: inline-flex; margin-top: 3px; align-items: center; height: 18px; padding: 3px 4px;
  background: var(--ml-green); color: #FFF;
  font-size: 12px; font-weight: 600; line-height: 12px; border-radius: var(--r-badge);
}
.ship__promise { margin-top: 12px; font-size: 16px; font-weight: 600; color: var(--ml-green); }
.ship__promise--black { color: var(--ink); font-weight: 400; }
.ship__eta { margin-top: 3px; font-size: 14px; color: var(--ink-2); }
.ship__link { display: inline-block; margin-top: 2px; font-size: 14px; }
.ship__sub { margin-top: 16px; }
.ship__sub .ship__eta { margin-top: 0; }
.ship__sub .ship__link { margin-top: 4px; }
.stock { margin-top: 21px; }
.stock__title { font-size: 16px; font-weight: 600; line-height: 1.35; }
.stock__full { display: flex; align-items: center; margin-top: 2px; color: var(--ink-2); font-size: 14px; }
.stock__full img { width: 38px; height: 12px; margin-left: 5px; }
.qty {
  display: flex; align-items: center; width: 100%; height: 50px;
  margin: -8px 0 0; padding: 16px 38px 16px 16px;
  background: var(--surface-2); border-radius: var(--r-btn);
  font-size: 16px; position: relative; text-align: left;
}
.qty:after {
  content: ''; position: absolute; right: 16px; top: 50%;
  width: 7px; height: 7px; margin-top: -5px;
  border-style: solid; border-width: 0 2px 2px 0; border-color: #999;
  transform: rotate(-45deg);
}
.qty__hint { color: var(--ink-2); }
.actions { margin-top: 24px; display: grid; gap: 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 24px; border-radius: var(--r-btn);
  font-size: 16px; font-weight: 600; line-height: 48px;
  transition: box-shadow .25s ease-out, background-color .2s ease-out;
}
.btn svg { width: 18px; height: 18px; margin-right: 8px; }
.btn--primary { background: var(--ml-blue); color: #FFF; }
.btn--primary:active { background: var(--ml-blue-hover); }
.btn--secondary { background: var(--ml-blue-soft); color: var(--ml-blue); }
.btn--secondary:active { background: rgba(65, 137, 230, .25); }
.btn--ghost { background: #FFF; color: var(--ml-blue); border: 1px solid var(--line); }
.btn--danger { background: var(--ml-red); color: #FFF; }
.btn--full { width: 100%; }
.btn[disabled] { opacity: .6; }

/* vendedor */
.seller { display: flex; align-items: center; margin: 24px 16px 0; }
.seller__avatar { width: 48px; height: 48px; border-radius: 50%; background: #F0F0F0; overflow: hidden; }
.seller__avatar img { width: 100%; height: 100%; object-fit: cover; }
.seller__info { margin-left: 8px; }
.seller__name { display: flex; align-items: center; font-size: 14px; font-weight: 600; }
.seller__name .loja { font-weight: 400; }
.seller__name svg { width: 10px; height: 10px; margin-left: 4px; fill: var(--ml-blue); }
.seller__meta { margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.seller__follow {
  margin-left: auto; height: 32px; padding: 0 16px; border-radius: var(--r-btn);
  background: var(--ml-blue-soft); color: var(--ml-blue);
  font-size: 14px; font-weight: 600; line-height: 32px;
}

/* benefícios */
.benefits { margin: 24px 0 16px; padding: 0 16px; }
.benefits li { display: flex; margin-bottom: 16px; font-size: 14px; line-height: 20px; }
.benefits li:last-child { margin-bottom: 0; }
.benefits svg { flex: 0 0 16px; width: 16px; height: 16px; margin: 2px 12px 0 0; fill: #999; }
.benefits b { font-weight: 400; }
.pdp__links { display: flex; align-items: center; padding: 16px 16px 0; gap: 24px; font-size: 14px; }
.pdp__links a { display: flex; align-items: center; }
.pdp__links svg { width: 16px; height: 16px; margin-right: 8px; fill: var(--ml-blue); }
.pdp__more { display: flex; align-items: center; padding: 20px 16px; font-size: 14px; font-weight: 600; }
.pdp__more svg { width: 9px; height: 14px; margin-left: 8px; fill: var(--ml-blue); }

/* módulos de conteúdo */
.skeleton-card { margin: 24px 16px; padding: 32px; background: var(--surface); border: 1px solid var(--track); border-radius: var(--r-btn); }
.skeleton-card div { height: 12px; margin-bottom: 12px; border-radius: 2px; background: linear-gradient(90deg, #F0F0F0 25%, #E6E6E6 37%, #F0F0F0 63%); background-size: 400% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.skeleton-card div:nth-child(1) { width: 40%; }
.skeleton-card div:nth-child(4) { margin-bottom: 0; width: 70%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.block { margin-top: 34px; padding: 24px 16px 0; border-top: 1px solid var(--track); }
.block:first-of-type { margin-top: 71px; }
.block:first-child { border-top: 0; }
.block__title { font-size: 20px; font-weight: 400; line-height: 1.35; margin-bottom: 16px; padding-right: 35px; }
.block__text { font-size: 16px; font-weight: 300; line-height: 1.35; color: var(--ink); }
/* a descrição do anúncio tem parágrafos e listas: sem isso o texto vira um bloco só */
.block__text--longo { white-space: pre-line; }
.block__text--longo + .block__text--longo { margin-top: 12px; }
.bullets { margin-top: 20px; }
.bullets li { position: relative; padding-left: 16px; padding-right: 8px; margin-bottom: 18px; font-size: 16px; font-weight: 300; line-height: 21.6px; }
.bullets li:before { content: ''; position: absolute; left: 0; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--ink-2); }
.spec-row { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--track); font-size: 14px; }
.spec-row__icon { width: 32px; height: 32px; margin-right: 12px; border-radius: 50%; background: var(--surface-2); }
.spec-row__label { color: var(--ink); }
.spec-row__label b { font-weight: 600; }
.spec-bar { position: relative; height: 8px; margin-top: 10px; background: var(--track); border-radius: 4px; overflow: hidden; }
.spec-bar i { position: absolute; top: 0; height: 8px; background: var(--ml-blue); border-radius: 4px; }
.spec-scale { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.link-card { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-btn); font-size: 14px; font-weight: 600; }
.link-card svg { width: 9px; height: 14px; fill: var(--ml-blue); }
.seller-card { padding: 16px; }
.seller-card__head { display: flex; align-items: center; }
.seller-card__rep { margin-top: 16px; font-size: 14px; }
.seller-card__rep b { color: var(--ml-green); }
.rep-bars { display: flex; gap: 4px; margin-top: 8px; }
.rep-bars i { flex: 1; height: 8px; border-radius: 4px; background: var(--track); }
.rep-bars i.on { background: var(--ml-green); }
.rep-legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--ink-3); }
.rep-total { margin-top: 12px; font-size: 18px; font-weight: 600; }

/* ==========================================================================
   BARRA FIXA DE CTA (aparece quando as ações inline saem da tela)
   ========================================================================== */
.cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 890;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px calc(8px + var(--safe-b));
  background: #FFF; border-top: 1px solid var(--line);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
  transform: translateY(110%); transition: transform .22s ease-out;
}
.cta-bar.is-visible { transform: translateY(0); }
body:not(.on-pdp) .cta-bar { display: none; }  /* a barra fixa é só do anúncio */
.cta-bar .btn { flex: 1; }
.cta-bar .btn--secondary { flex: 0 0 48px; padding: 0; }
.cta-bar .btn--secondary svg { margin: 0; }

/* ==========================================================================
   TELAS DO FUNIL
   ========================================================================== */
.checkout-wrap { background: var(--page); min-height: 100vh; min-height: 100dvh; padding-bottom: calc(88px + var(--safe-b)); }
.steps {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: #FFF; font-size: 12px; color: var(--ink-2);
  border-bottom: 1px solid var(--track);
}
.steps__item { display: flex; align-items: center; gap: 6px; }
.steps__num {
  width: 18px; height: 18px; border-radius: 50%; background: var(--track); color: var(--ink-2);
  font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}
.steps__item.is-active { color: var(--ink); font-weight: 600; }
.steps__item.is-active .steps__num { background: var(--ml-blue); color: #FFF; }
.steps__item.is-done .steps__num { background: var(--ml-green); color: #FFF; }
.steps__sep { width: 8px; height: 1px; background: var(--line); }

.card-block { background: #FFF; margin-top: 8px; padding: 16px; }
.card-block--flat { margin-top: 0; }
.card-block__title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.card-block__row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--track); }
.card-block__row:last-child { border-bottom: 0; }
.muted { color: var(--ink-2); font-size: 14px; }
.small { font-size: 12px; }
.green { color: var(--ml-green); }
.red { color: var(--ml-red); }
.blue { color: var(--ml-blue); }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* item do carrinho */
.cart-item { display: flex; padding: 16px; background: #FFF; }
.cart-item__img { width: 72px; height: 72px; border-radius: var(--r-btn); background: var(--surface-2); object-fit: contain; }
.cart-item__body { flex: 1; margin-left: 12px; }
.cart-item__title { font-size: 14px; line-height: 1.3; }
.cart-item__meta { margin-top: 4px; font-size: 12px; color: var(--ink-2); }
.cart-item__price { margin-top: 8px; font-size: 18px; font-weight: 600; }
.cart-item__ship { display: flex; align-items: center; margin-top: 4px; font-size: 12px; color: var(--ml-green); font-weight: 600; }
.qty-pill {
  display: inline-flex; align-items: center; margin-top: 8px;
  border: 1px solid var(--line); border-radius: var(--r-btn); overflow: hidden;
}
.qty-pill button { width: 36px; height: 32px; font-size: 16px; color: var(--ml-blue); }
.qty-pill span { min-width: 32px; text-align: center; font-size: 14px; }

.summary { background: #FFF; padding: 16px; margin-top: 8px; }
.summary__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary__row--total { padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line); font-size: 18px; font-weight: 600; }
.summary__row .g { color: var(--ml-green); }

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 880;
  padding: 12px 16px calc(12px + var(--safe-b)); background: #FFF;
  border-top: 1px solid var(--line);
}
.bottom-bar .btn + .btn { margin-top: 8px; }
.bottom-bar__note { margin-top: 8px; font-size: 12px; color: var(--ink-2); text-align: center; }

/* meios de pagamento */
.pay-option {
  display: flex; align-items: center; width: 100%; padding: 16px;
  background: #FFF; border-bottom: 1px solid var(--track); text-align: left;
}
.pay-option:last-child { border-bottom: 0; }
.pay-option__icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-btn); background: var(--surface-2); margin-right: 12px; }
.pay-option__icon svg { width: 22px; height: 22px; }
.pay-option__body { flex: 1; }
.pay-option__title { font-size: 16px; font-weight: 600; }
.pay-option__sub { margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.pay-option__sub .g { color: var(--ml-green); font-weight: 600; }
.pay-option__check { width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 50%; }
.pay-option.is-selected .pay-option__check { border-color: var(--ml-blue); background: var(--ml-blue); box-shadow: inset 0 0 0 3px #FFF; }

/* formulário */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--ink); }
.field input, .field select {
  width: 100%; height: 48px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: #FFF;
  font-size: 16px; color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--ml-blue); }
.field input.is-invalid { border-color: var(--ml-red); }
.field__error { margin-top: 4px; font-size: 12px; color: var(--ml-red); display: none; }
.field.has-error .field__error { display: block; }
.field--row { display: flex; gap: 12px; }
.field--row > * { flex: 1; }
.card-brand { position: absolute; right: 12px; top: 38px; font-size: 12px; color: var(--ink-2); }
.field--card { position: relative; }

/* pix */
.pix-head { padding: 24px 16px 16px; background: #FFF; text-align: center; }
.pix-timer {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  padding: 6px 12px; border-radius: var(--r-pill); background: var(--surface-2);
  font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pix-qr {
  width: 240px; height: 240px; margin: 8px auto 0; padding: 8px;
  background: #FFF; border: 1px solid var(--line); border-radius: var(--r-btn);
}
.pix-sign { margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.copy-box { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.copy-box input {
  flex: 1; height: 48px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: var(--r-btn); font-size: 12px; color: var(--ink-2);
  text-overflow: ellipsis;
}
.copy-box .btn { flex: 0 0 auto; }
.pix-steps { margin-top: 16px; }
.pix-steps li { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; font-size: 14px; color: var(--ink-2); }
.pix-steps b { color: var(--ink); font-weight: 600; }

/* processamento e resultado */
.status-screen {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 24px calc(32px + var(--safe-b));
  background: #FFF; text-align: center;
}
.ring { width: 96px; height: 96px; }
.ring circle { fill: none; stroke-width: 6; }
.ring__bg { stroke: var(--track); }
.ring__fg { stroke: var(--ml-blue); stroke-linecap: round; stroke-dasharray: 264; stroke-dashoffset: 66; transform-origin: 50% 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-circle {
  width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  animation: pop .32s cubic-bezier(.2, 1.4, .4, 1) both;
}
.status-circle--ok { background: var(--ml-green); }
.status-circle--err { background: var(--ml-red); }
.status-circle svg { width: 48px; height: 48px; stroke: #FFF; stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
@keyframes pop { from { transform: scale(.6); opacity: .4; } to { transform: scale(1); opacity: 1; } }
.status-title { margin-top: 24px; font-size: 20px; font-weight: 600; }
.status-sub { margin-top: 8px; font-size: 14px; color: var(--ink-2); max-width: 300px; }
.status-detail { margin-top: 12px; padding: 4px 8px; border-radius: var(--r-badge); background: var(--surface-2); color: var(--ink-2); }
.dots-anim:after { content: ''; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.receipt { width: 100%; max-width: 358px; margin-top: 24px; background: #FFF; border: 1px solid var(--line); border-radius: var(--r-btn); padding: 16px; text-align: left; }
.receipt__row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.receipt__row span:first-child { color: var(--ink-2); }

/* toast */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(88px + var(--safe-b)); z-index: 950;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--r-btn);
  background: #323232; color: #FFF; font-size: 14px;
  box-shadow: var(--shadow-2);
  transform: translateY(140%); opacity: 0; pointer-events: none;
  transition: transform .25s ease-out, opacity .25s ease-out;
}
.toast.is-visible { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast img { width: 32px; height: 32px; border-radius: 4px; background: #FFF; }


/* ==========================================================================
   BOTTOM SHEET, VISUALIZADOR DE IMAGENS E DIAGNÓSTICO
   ========================================================================== */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 990; background: rgba(0, 0, 0, .5);
  opacity: 0; pointer-events: none; transition: opacity .2s ease-out;
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 991;
  background: #FFF; border-radius: 12px 12px 0 0;
  padding: 24px 16px calc(24px + var(--safe-b));
  max-height: 80vh; overflow-y: auto;
  transform: translateY(101%); transition: transform .24s ease-out;
}
.sheet.is-open { transform: translateY(0); }
.sheet__title { font-size: 18px; font-weight: 600; margin-bottom: 16px; }
.sheet__close {
  position: absolute; top: 14px; right: 12px; width: 40px; height: 40px;
  font-size: 20px; color: var(--ink-3); line-height: 40px; text-align: center;
}
.sheet-option {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 16px 0; border-bottom: 1px solid var(--track); font-size: 16px; text-align: left;
}
.sheet-option:last-child { border-bottom: 0; }
.sheet-option.is-selected { color: var(--ml-blue); font-weight: 600; }
.sheet-option.is-selected::after { content: '✓'; }
.sheet__text { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.sheet__text b { color: var(--ink); }

.viewer {
  position: fixed; inset: 0; z-index: 1000; background: #000;
  display: none; flex-direction: column;
}
.viewer.is-open { display: flex; }
.viewer__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + var(--safe-t)) 16px 8px; color: #FFF; font-size: 14px;
}
.viewer__close { width: 44px; height: 44px; color: #FFF; font-size: 24px; line-height: 44px; text-align: center; }
.viewer__track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; }
.viewer__slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; align-items: center; justify-content: center; }
.viewer__slide img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

.circle-btn.is-on svg { fill: var(--ml-blue); }
.circle-btn.is-on { background: #FFF; }

.diag {
  position: fixed; inset: 0; z-index: 1100; background: #111; color: #0F0;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  padding: calc(12px + var(--safe-t)) 12px 12px; overflow: auto; line-height: 1.6;
}
.diag b { color: #FFF; }
.diag__row { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px solid #333; padding: 4px 0; }
.diag__ok { color: #6F6; }
.diag__bad { color: #F66; }

/* shell de debug (log da captura) */
.debug-fab {
  position: fixed; right: 12px; bottom: calc(96px + var(--safe-b)); z-index: 960;
  width: 40px; height: 40px; border-radius: 50%; background: rgba(0, 0, 0, .55);
  color: #FFF; font-size: 16px; line-height: 40px; text-align: center;
}
.debug-panel {
  position: fixed; inset: auto 0 0 0; z-index: 970; max-height: 60vh; overflow: auto;
  background: #111; color: #0F0; font-family: ui-monospace, Menlo, monospace;
  font-size: 11px; padding: 12px; transform: translateY(100%); transition: transform .25s;
}
.debug-panel.is-open { transform: translateY(0); }
.debug-panel pre { margin: 0 0 8px; white-space: pre-wrap; word-break: break-all; }

@media (min-width: 480px) {
  .gallery__slide { flex-basis: 480px; width: 480px; }
}

/* erro de campo (etapa de entrega) */
.field--erro input { border-color: #F23D4F; }
.field__erro { display: block; color: #F23D4F; font-size: 12px; margin-top: 4px; }

/* ============================================================================
   DESKTOP — o anúncio é mobile por natureza; no computador ele fica numa
   moldura de celular centralizada, em vez de esticar e parecer quebrado.
   ========================================================================== */
@media (min-width: 760px) {
  html { background: #cfd3d8; }
  body {
    max-width: 430px; margin: 0 auto; background: var(--fundo, #EDEDED);
    box-shadow: 0 0 0 1px rgba(0,0,0,.10), 0 24px 70px rgba(0,0,0,.22);
    min-height: 100vh;
  }
  /* tudo que é fixo acompanha a coluna, senão vaza para as laterais */
  .cta-bar, .bottom-bar, .toast, .diag {
    left: 50% !important; right: auto !important;
    transform: translateX(-50%); width: 100%; max-width: 430px;
  }
  .sheet, .viewer { left: 50% !important; right: auto !important; transform: translateX(-50%); width: 100%; max-width: 430px; }
  .sheet__backdrop { max-width: none; }
  .toast { bottom: calc(88px + var(--safe-b)); }
}
