/* =====================================================================
   M3 · Acesso e captação — complementos pequenos do design system (app.css).
   Telas: entrar, cadastro, código, senha, "Quero vender", "Estou procurando".
   Mobile-first, alvos de toque ≥ 44px, respeita prefers-reduced-motion.
   ===================================================================== */

/* E-mail ou domínio longo no subtítulo das telas de acesso quebra a linha em vez de estourar em 360 px */
.auth-card { overflow-wrap: break-word; }

/* Alvo de toque para links curtos e caixas de seleção */
.m3-tap { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
.check.m3-check { min-height: 44px; padding-block: .3rem; align-items: flex-start; }
.check.m3-check input { margin-top: 3px; }
.check.m3-check span { min-width: 0; overflow-wrap: anywhere; }

/* Senha com "Mostrar" */
.m3-password { position: relative; }
.m3-password .input { padding-right: 5.6rem; }
.m3-eye { position: absolute; top: 2px; right: 2px; bottom: 2px; min-width: 44px; padding: 0 .9rem; border-radius: calc(var(--radius-sm) - 2px); background: transparent; color: var(--brand); font-weight: 650; font-size: .88rem; }
.m3-eye:hover { background: var(--brand-soft); }
.m3-caps { color: var(--warning); font-weight: 600; }
/* Região aria-live vazia: fora do grid do .field (sem vão extra), mas continua na árvore de acessibilidade */
.m3-password-field { position: relative; }
.m3-caps:empty { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Divisor "Novo por aqui?" */
.m3-divider { display: flex; align-items: center; gap: .75rem; color: var(--text-3); font-size: .85rem; }
.m3-divider::before, .m3-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* Indicador de etapas (cadastro, vender, procuro) */
.m3-progress { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.m3-progress li { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); font-size: .86rem; font-weight: 620; transition: background .25s var(--ease), color .25s var(--ease); }
.m3-progress li > span:first-child { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--surface); font-variant-numeric: tabular-nums; }
.m3-progress li[aria-current="step"] { background: var(--brand-soft); color: var(--brand); }
.m3-progress li[aria-current="step"] > span:first-child { background: var(--brand); color: var(--brand-contrast); }
.m3-progress li.is-done > span:first-child { background: var(--success); color: #fff; }
.m3-progress .label { min-width: 0; line-height: 1.2; overflow-wrap: anywhere; }

/* Botão com texto longo pode quebrar linha no celular (o .btn padrão é nowrap) */
.btn.m3-wrap { white-space: normal; text-align: center; line-height: 1.25; }

/* Formulário em 2 passos (com JS um passo por vez; sem JS tudo aparece) */
.m3-steps fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.m3-legend { padding: 0; margin-bottom: .25rem; font-family: var(--font-display); font-size: 1.25rem; font-weight: 750; letter-spacing: -.015em; }
.m3-legend:focus { outline: none; }
.m3-steps.is-stepped [data-step]:not(.is-current) { display: none; }
.m3-steps.is-stepped [data-step].is-current { animation: m3-in .35s var(--ease) both; }
.m3-steps.is-stepped [data-nojs-only] { display: none; }
@keyframes m3-in { from { opacity: 0; transform: translateX(14px); } }

.m3-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: .5rem; }
.m3-fieldset > legend { padding: 0; margin-bottom: .45rem; }
/* Grupos (fieldset) dentro dos passos com o espaço do .stack: o "margin: 0" acima deixava "Tipo", "Onde" e "Preço" colados */
.m3-steps [data-step] > * + fieldset, .m3-steps .stack > fieldset + fieldset { margin-top: var(--stack, 1rem); }
.m3-steps [data-step] > .m3-step-hint { margin-top: .15rem; }
.m3-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding-top: .25rem; }
.m3-actions .btn-primary { flex: 1 1 220px; }
@media (min-width: 640px) { .m3-actions .btn-primary { flex: 0 0 auto; } }

/* Tipo (gado/fazenda) ocupa a largura toda */
.m3-segmented { display: flex; width: 100%; }
.m3-segmented label { flex: 1 1 0; min-width: 0; }
.m3-segmented span { width: 100%; justify-content: center; min-height: 44px; }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Faixas "de / até" lado a lado também no celular (minmax(0, …): o campo nunca empurra a coluna para fora em 360 px) */
.m3-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }

/* Resumo de erros no topo do formulário */
.m3-error-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .15rem; overflow-wrap: anywhere; }

/* Chips de múltipla escolha (checkbox acessível) */
.m3-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.m3-chip { position: relative; display: inline-flex; }
.m3-chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.m3-chip .chip { min-height: 44px; cursor: pointer; user-select: none; }
.m3-chip input:focus-visible + .chip { outline: 2px solid var(--focus); outline-offset: 2px; }
.m3-chip input:checked + .chip::before { content: ""; width: .5em; height: .85em; margin-right: .1rem; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -2px); }
.m3-more > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; color: var(--brand); font-weight: 620; font-size: .92rem; }
.m3-more[open] > summary { margin-bottom: .4rem; }
/* "Mais detalhes (opcional)" do passo 1 de "Estou procurando": opcionais juntos, fechados por padrão */
.m3-more-details { border-top: 1px solid var(--line); padding-top: .5rem; }
.m3-more-details > summary { gap: .35rem; list-style: none; }
.m3-more-details > summary::-webkit-details-marker { display: none; }
.m3-more-details > summary .icon { transition: transform .2s var(--ease); }
.m3-more-details[open] > summary .icon { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .m3-more-details > summary .icon { transition: none; } }
.m3-switch { min-height: 44px; }

/* Fotos ("Quero vender") */
.m3-file { width: 100%; min-height: 48px; padding: .6rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--bg-elevated); font-size: 16px; }
.m3-file.is-enhanced { position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; border: 0; opacity: 0; overflow: hidden; clip-path: inset(50%); }
.m3-file.is-enhanced:focus-visible + .m3-drop { outline: 2px solid var(--focus); outline-offset: 2px; }
.m3-drop { min-height: 120px; }
.m3-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(30%, 96px), 1fr)); gap: 8px; list-style: none; padding: 0; margin: 0; }
.m3-photos:empty { display: none; }
.m3-photos li { position: relative; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); animation: m3-pop .4s var(--ease-spring) both; }
.m3-photos img { width: 100%; height: 100%; object-fit: cover; }
.m3-photos button { position: absolute; top: 0; right: 0; display: grid; place-items: center; width: 44px; height: 44px; color: #fff; }
.m3-photos button::before { content: ""; position: absolute; width: 28px; height: 28px; border-radius: 50%; background: rgb(6 20 14 / .72); }
.m3-photos button .icon { position: relative; width: 16px; height: 16px; }

/* Confirmações */
.m3-done { text-align: center; justify-items: center; }
.m3-done .icon-bubble { width: 76px; height: 76px; border-radius: 24px; margin-inline: auto; background: var(--success-soft); color: var(--success); }
.m3-done .callout { text-align: left; }
.m3-code { font-family: var(--font-display); font-weight: 800; letter-spacing: .02em; font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.4rem); line-height: 1; }
.m3-title { font-weight: 650; max-width: 52ch; margin-inline: auto; overflow-wrap: anywhere; }
.m3-pop { animation: m3-pop .6s var(--ease-spring) both; }
@keyframes m3-pop { from { opacity: 0; transform: scale(.6); } }
.m3-band { display: flex; gap: .9rem; align-items: center; padding: 16px 18px; border-radius: var(--radius-lg); background: var(--green-950); color: #dbeee2; }
.m3-band .icon-bubble { background: rgb(184 230 90 / .16); color: var(--lime-300); }
.m3-band strong { color: #fff; }
.m3-band-note { display: block; margin-top: .2rem; color: #9fb8a8; }
.m3-steps-list { list-style: none; padding: 0; }
.m3-list { list-style: none; padding: 0; display: grid; gap: .7rem; }
.m3-list li { display: flex; gap: .7rem; align-items: flex-start; font-size: .94rem; }
.m3-num { display: inline-grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-weight: 750; font-size: .85rem; }
.m3-chip-list { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; list-style: none; padding: 0; }
.m3-chip-list .chip { white-space: normal; text-align: center; }

/* Lotes compatíveis */
.m3-match { position: relative; display: grid; gap: .5rem; align-content: start; }
.m3-score { justify-self: start; }

/* "Parecido com" (vindo do anúncio) */
.m3-ref { display: flex; align-items: center; gap: .8rem; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.m3-ref img { width: 64px; height: 64px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.m3-ref .grow { display: grid; gap: .1rem; min-width: 0; }

@media (prefers-reduced-motion: reduce) {
  .m3-steps.is-stepped [data-step].is-current, .m3-pop, .m3-photos li { animation: none; }
}

/* == Telas de acesso: "Voltar ao site" e lote de origem == */
/* Topo do cartão: logo (some quando a lateral, que já tem a logo, aparece) e "Voltar ao site" */
.auth-top { --gap: .25rem .75rem; margin-bottom: 1rem; }
@media (min-width: 960px) { .auth-top-logo { display: none; } }
.auth-back, .m3-back { gap: .35rem; justify-content: flex-start; font-weight: 600; text-decoration: none; }
.auth-back:hover, .m3-back:hover { text-decoration: underline; }
/* "Para ofertar no FG-1001 · …" com "Voltar ao anúncio" (título longo quebra a linha) */
.m3-from { align-items: flex-start; }
.m3-from-body { display: grid; gap: .1rem; min-width: 0; }
.m3-from-body p { margin: 0; overflow-wrap: anywhere; }
.m3-back { justify-self: start; margin-bottom: -10px; }
.m3-from + .m3-progress { margin-top: 1rem; }
