/* =====================================================================
   Fácil Gado · M2 (mercado, ferramentas, páginas, verificar)
   Só complementa o design system (app.css). Tokens do app.css; claro/escuro automático.
   Mobile-first: nada passa de 360 px; alvos de toque ≥ 44 px; efeitos respeitam prefers-reduced-motion.
   ===================================================================== */

/* ---------- Transição suave entre páginas do site (navegadores que suportam) ---------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
}

/* ---------- Base das páginas ---------- */
.m2-page { min-width: 0; }
.m2-title { font-size: clamp(1.75rem, 1.2rem + 2.6vw, 2.8rem); max-width: 22ch; }
.m2-hero { padding-bottom: clamp(12px, 3vw, 24px); }
.m2-hero .lead { margin-top: .6rem; }
.m2-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1rem; color: var(--text-2); margin-top: .75rem; }
.m2-disclaimer { display: inline-flex; align-items: center; gap: .4rem; margin-top: .6rem; padding: .35rem .75rem; border-radius: var(--pill); background: var(--surface-2); color: var(--text-2); font-weight: 560; }
.m2-break { overflow-wrap: anywhere; word-break: normal; }
.m2-money { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.m2-big { font-family: var(--font-display); font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); font-weight: 780; letter-spacing: -.02em; line-height: 1.15; }
.m2-big small { font-size: .55em; font-weight: 600; color: var(--text-2); }
.m2-eyebrow-light { color: var(--lime-300); }
.m2-btn-light { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgb(255 255 255 / .45); }
.m2-btn-light:hover { --btn-bg: rgb(255 255 255 / .1); border-color: #fff; }
.m2-pills { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.m2-pills li { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .85rem; border-radius: var(--pill); background: var(--brand-soft); color: var(--brand); font-size: .86rem; font-weight: 620; }
.m2-list { padding-left: 1.2em; display: grid; gap: .3rem; }
.m2-formula { padding: .7rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Mercado: aviso de cotação velha, atalho da equipe e estado vazio ---------- */
.m2-stale { display: flex; align-items: flex-start; gap: .4rem; width: fit-content; max-width: 100%; margin-top: .6rem; padding: .4rem .75rem; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); font-weight: 560; }
.m2-stale .icon { color: var(--warning); margin-top: 2px; flex: none; }
.m2-staff { margin-top: .9rem; }
/* Quadro da equipe vazio: uma linha (o quadro do Imea acima é o conteúdo principal). */
.m2-empty-line { display: grid; gap: .6rem; justify-items: start; }
.m2-empty-line p { display: flex; align-items: flex-start; gap: .4rem; color: var(--text-2); }
.m2-empty-line .icon { flex: none; margin-top: 3px; color: var(--text-3); }

/* ---------- Mercado: referência externa (widget do Notícias Agrícolas em iframe) ----------
   O conteúdo do iframe é claro e vem de outro domínio: fica num cartão claro também no tema escuro, de propósito.
   A tabela ocupa 100% do iframe (largura=100%); a altura segue a largura do cartão (container query),
   medida com as 8 praças: abaixo de 300 px os nomes e títulos quebram em 2 linhas. Sobra pouco; se faltar, rola dentro. */
.m2-ref-lead { padding-top: clamp(8px, 2vw, 16px); } /* sem quadro nosso: cola no topo, é o conteúdo principal */
.m2-ref { display: grid; gap: 1rem; align-items: start; }
.m2-ref-card { container-type: inline-size; width: 100%; max-width: 560px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color-scheme: light; box-shadow: var(--shadow-sm); }
/* Alturas com folga para a fonte do Android (Roboto no lugar de Arial: linhas de 24 px em vez de 22) */
.m2-ref-frame { display: block; width: 100%; height: 344px; border: 0; background: #fff; }
@container (min-width: 330px) { .m2-ref-frame { height: 326px; } }
.m2-ref-side { display: grid; gap: .75rem; justify-items: start; max-width: 560px; min-width: 0; }
.m2-ref-note { display: flex; align-items: flex-start; gap: .4rem; color: var(--text-2); }
.m2-ref-note .icon { flex: none; margin-top: 3px; }
@media (min-width: 900px) {
  .m2-ref { grid-template-columns: minmax(0, 560px) minmax(0, 340px); gap: clamp(20px, 3vw, 40px); }
}
/* Escuro: o cartão continua claro (sem filtro no iframe: o Chromium pode deixá-lo em branco). */
:root[data-theme="dark"] .m2-ref-card { border-color: transparent; box-shadow: 0 0 0 1px rgb(255 255 255 / .06); }

/* ---------- Mercado: cartões de cotação ---------- */
.m2-cards { --gap: 1rem; }
.m2-quote { display: grid; gap: .45rem; align-content: start; }
.m2-quote-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.m2-quote-head h2 { font-family: var(--font-sans); font-weight: 680; }
.m2-quote-value { font-family: var(--font-display); font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.1; overflow-wrap: anywhere; }
.m2-quote-value small { font-size: .5em; font-weight: 600; color: var(--text-2); margin-left: .15em; }
.m2-quote-change { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: wrap; font-weight: 650; }
.m2-quote-change .subtle { font-weight: 500; }
/* Cartão com data própria (categoria não atualizada junto com as outras); amarelo a partir de STALE_DAYS. */
.m2-quote-date { display: inline-flex; align-items: center; gap: .3rem; width: fit-content; max-width: 100%; color: var(--text-3); font-weight: 560; }
.m2-quote-date.is-stale { padding: .2rem .6rem; border-radius: var(--pill); background: var(--warning-soft); color: var(--text); }
.m2-quote-date.is-stale .icon { color: var(--warning); }
.m2-spark { width: 100%; height: 40px; overflow: visible; color: var(--text-3); }
.m2-spark-up { color: var(--success); }
.m2-spark-down { color: var(--danger); }
.m2-spark-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m2-spark-area { fill: currentColor; opacity: .1; stroke: none; }
@media (prefers-reduced-motion: no-preference) {
  .m2-quote.reveal .m2-spark-line { stroke-dasharray: 400; stroke-dashoffset: 400; transition: stroke-dashoffset 1.2s var(--ease) .15s; }
  .m2-quote.reveal.is-visible .m2-spark-line { stroke-dashoffset: 0; }
}

/* Quadro por praça */
.m2-matrix td { white-space: normal; }
.m2-matrix td.num > * + * { margin-left: .35rem; }
.m2-chg { font-weight: 650; }
@media (max-width: 767px) {
  .m2-matrix td.num { flex-wrap: wrap; justify-content: flex-end; }
  .m2-matrix td.num::before { margin-right: auto; }
}

/* Oferta e procura */
.m2-supply { display: grid; gap: .25rem; align-content: start; min-height: 44px; }
.m2-supply-num { font-family: var(--font-display); font-size: 1.45rem; font-weight: 780; letter-spacing: -.02em; }
.m2-demand { display: grid; gap: .5rem; align-content: start; }
.m2-demand-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.m2-demand-head h3 { font-family: var(--font-sans); font-weight: 680; }
.m2-band .badge { font-size: .85rem; padding: .3rem .75rem; }
.m2-callout-cta { align-items: flex-start; }

/* ---------- Ferramentas ---------- */
.m2-anchors { display: flex; flex-wrap: wrap; gap: .5rem; }
.m2-anchors .chip { min-height: 44px; }
.m2-anchor { scroll-margin-top: calc(var(--header-h) + 16px); }
.m2-form fieldset { border: 0; padding: 1.25rem 0 0; margin: 0; min-width: 0; }
.m2-form fieldset:first-of-type { padding-top: 0; }
.m2-form .form-section { border-top: 1px solid var(--line); margin-top: 1.25rem; }
.m2-form .form-section:first-of-type { border-top: 0; margin-top: 0; }
.m2-legend { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1rem; margin-bottom: .9rem; padding: 0; }
.m2-step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--brand); color: var(--brand-contrast); font-size: .8rem; font-weight: 800; flex: none; }
.m2-form .input-group .input { min-width: 0; }
.m2-form .form-actions { justify-content: stretch; }
.m2-btn-wide { width: 100%; }
@media (min-width: 640px) { .m2-btn-wide { width: auto; } .m2-form .form-actions { justify-content: flex-end; } }
.m2-tool { align-items: start; }
.m2-result .big { font-size: clamp(1.6rem, 1.25rem + 1.6vw, 2.3rem); overflow-wrap: anywhere; }
.m2-result .rows dd { text-align: right; }
.m2-negative { color: var(--danger); font-weight: 600; }
.m2-verdict { display: grid; gap: .4rem; padding: .8rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.m2-verdict .badge { justify-self: start; font-size: .82rem; }
.m2-breakdown summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--brand); }
.m2-breakdown .m2-total { padding-top: .45rem; border-top: 1px solid var(--line); font-weight: 750; }
.m2-segmented { flex-wrap: wrap; max-width: 100%; border: 0; margin: 0; min-width: 0; border-radius: var(--radius); }
.m2-segmented span { min-height: 44px; }
.m2-conv-out { grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); }
.m2-conv-out dd { overflow-wrap: anywhere; }
.m2-checklist { list-style: none; padding: 0; display: grid; gap: .55rem; }
.m2-checklist li { display: flex; gap: .55rem; align-items: flex-start; }
.m2-checklist .icon { color: var(--success); margin-top: 2px; }
@media (max-width: 1023px) { .m2-tool .sticky-side { position: static; } }

/* ---------- Como funciona ---------- */
.m2-journeys { --gap: clamp(24px, 4vw, 40px); }
.m2-journeys h2 .icon-bubble { width: 40px; height: 40px; }
.m2-fee-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.m2-fee-grid div { padding: .75rem .9rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.m2-fee-grid dt { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.m2-fee-grid dd { font-family: var(--font-display); font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); font-weight: 800; letter-spacing: -.02em; overflow-wrap: anywhere; }
.m2-faq { display: grid; gap: .6rem; }
.m2-faq details { padding: 0; }
.m2-faq summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 52px; padding: .85rem 1.1rem; cursor: pointer; font-weight: 650; list-style: none; }
.m2-faq summary::-webkit-details-marker { display: none; }
.m2-faq summary::after { content: "+"; font-size: 1.3rem; line-height: 1; color: var(--brand); flex: none; transition: transform .2s var(--ease); }
.m2-faq details[open] summary::after { transform: rotate(45deg); }
.m2-faq details p { padding: 0 1.1rem 1rem; }

/* Link solto (fora de frase) com alvo de toque de 44 px */
.m2-tap { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Verificar (escudo antigolpe) ---------- */
.m2-verify-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.m2-verify-row .input { flex: 1 1 200px; min-width: 0; }
.m2-verify-row .btn { flex: 1 1 auto; min-height: 48px; }
@media (min-width: 480px) { .m2-verify-row .btn { flex: 0 0 auto; } }
.m2-code-input { text-transform: uppercase; letter-spacing: .06em; font-weight: 650; font-variant-numeric: tabular-nums; }
.m2-code-input::placeholder { text-transform: none; letter-spacing: normal; font-weight: 400; }
.m2-verify-result { border-width: 2px; }
.m2-tone-success { border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }
.m2-tone-warning { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); }
.m2-tone-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.m2-tone-info, .m2-tone-brand { border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }
.m2-verify-head { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; }
.m2-verify-head .grow { flex: 1 1 180px; min-width: 0; }
.m2-tone-success .m2-verify-icon { background: var(--success-soft); color: var(--success); }
.m2-tone-warning .m2-verify-icon { background: var(--warning-soft); color: var(--warning); }
.m2-tone-danger .m2-verify-icon { background: var(--danger-soft); color: var(--danger); }
.m2-verify-listing { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; padding: .75rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.m2-verify-listing img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-xs); flex: none; }
.m2-verify-listing .stack { flex: 1 1 160px; min-width: 0; }
.m2-verify-confirm { display: flex; gap: .5rem; align-items: flex-start; margin: 0; }
.m2-verify-confirm .icon { color: var(--brand); margin-top: 2px; flex: none; }
.m2-verify-confirm > span { min-width: 0; overflow-wrap: anywhere; }
.m2-channel { display: flex; align-items: center; gap: .8rem; min-height: 44px; min-width: 0; }
.m2-channel .stack { min-width: 0; display: flex; flex-direction: column; } /* spans: rótulo em cima, valor embaixo */
.m2-tips { list-style: none; padding: 0; display: grid; gap: .6rem; }
.m2-tips li { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.m2-tips .icon { color: var(--brand); margin-top: 2px; }

/* ---------- Textos legais ---------- */
.m2-legal-layout { display: grid; gap: 32px; }
@media (min-width: 1024px) {
  .m2-legal-layout { grid-template-columns: 240px minmax(0, 1fr); gap: 56px; }
  .m2-toc { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; max-height: calc(100dvh - var(--header-h) - 40px); overflow-y: auto; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .m2-toc .m2-toc-list { display: flex; flex-wrap: wrap; gap: .25rem .5rem; }
}
.m2-toc-list { list-style: none; padding: 0; margin-top: .6rem; display: grid; gap: .15rem; font-size: .9rem; }
.m2-toc-list a { display: block; padding: .4rem .6rem; border-radius: var(--radius-xs); color: var(--text-2); }
.m2-toc-list a:hover { background: var(--surface-2); color: var(--text); }
.m2-toc-mobile summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; }
.m2-toc-mobile .m2-toc-list a { min-height: 44px; display: flex; align-items: center; }
.m2-prose { min-width: 0; }
.m2-prose h2 { scroll-margin-top: calc(var(--header-h) + 16px); }
.m2-prose ol ul { margin-top: .4em; }
.m2-prose .table-wrap { margin-top: 1em; }
.m2-prose .table td { vertical-align: top; }
.m2-legal-facts { display: grid; gap: .6rem; }
.m2-legal-facts div { padding: .8rem 1rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.m2-legal-facts dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }
.m2-legal-facts dd { overflow-wrap: anywhere; }
@media (max-width: 767px) {
  .m2-prose .table-cards td { text-align: left; flex-direction: column; gap: .15rem; }
}

@media print {
  .m2-toc, .m2-toc-mobile, .site-header, .site-footer, .bottom-nav { display: none !important; }
  .m2-legal-layout { display: block; }
}
