/* =========================================================
   Balança Autônoma · Grupo MTF
   Azul da logo + branco. Verde só para sucesso, vermelho só para erro.

   Regra de layout: cada tela cabe inteira na altura visível do celular,
   sem rolagem. O app ocupa 100% da altura e, se o conteúdo não couber,
   js/fit.js aplica níveis de compactação (data-fit="1".."4" no .app):
   espaçamentos e elementos visuais diminuem, e elementos de apoio
   marcados com .fit-2/.fit-3/.fit-4 saem nessa ordem.
   ========================================================= */

:root {
  --blue: #283F6B;
  --blue-800: #1E3054;
  --blue-900: #15233F;
  --blue-200: #C9D4E6;
  --blue-100: #E2E8F2;
  --blue-50: #F1F4F9;
  --white: #FFFFFF;

  --ink: #0E1A30;
  --text: #24324A;
  --muted: #4A5872;
  --faint: #7D8AA1;
  --line: #D5DDE8;

  --success: #16803C;
  --success-ink: #0F5C2B;
  --success-50: #E7F5EC;
  --danger: #C3262E;
  --danger-ink: #8E1B21;
  --danger-50: #FDECEC;

  --radius: 14px;
  --radius-lg: 18px;
  --gutter: 20px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Consolas, "Roboto Mono", monospace;
}

/* Medidas que encolhem com o nível de compactação */
.app {
  --gap: 18px;        /* entre blocos */
  --gap-sm: 10px;     /* dentro de blocos */
  --head-h: 60px;
  --title: 1.75rem;
  --lead: 1.0625rem;
  --btn-h: 64px;
  --btn2-h: 54px;
  --opt-h: 56px;
  --axle-h: 60px;
  --row-pad: 14px;
  --mark: 84px;
  --pulse: 156px;
  --qr: 196px;
  --weight: 3.5rem;
  --scene-max: 34dvh;
}
.app[data-fit="1"] {
  --gap: 13px; --gap-sm: 8px; --head-h: 56px; --title: 1.5rem; --lead: 1rem;
  --btn-h: 58px; --btn2-h: 50px; --opt-h: 50px; --axle-h: 54px; --row-pad: 11px;
  --mark: 68px; --pulse: 128px; --qr: 168px; --weight: 3.125rem; --scene-max: 28dvh;
}
.app[data-fit="2"] {
  --gap: 10px; --gap-sm: 6px; --head-h: 52px; --title: 1.375rem; --lead: .9375rem;
  --btn-h: 54px; --btn2-h: 46px; --opt-h: 46px; --axle-h: 50px; --row-pad: 9px;
  --mark: 56px; --pulse: 104px; --qr: 144px; --weight: 2.75rem; --scene-max: 24dvh;
}
.app[data-fit="3"], .app[data-fit="4"] {
  --gap: 7px; --gap-sm: 4px; --head-h: 46px; --title: 1.25rem; --lead: .9375rem;
  --btn-h: 52px; --btn2-h: 44px; --opt-h: 42px; --axle-h: 46px; --row-pad: 7px;
  --mark: 44px; --pulse: 84px; --qr: 124px; --weight: 2.5rem; --scene-max: 20dvh;
}
.app[data-fit="4"] { --qr: 108px; --scene-max: 16dvh; }

.app[data-fit="2"] .fit-2,
.app[data-fit="3"] .fit-2, .app[data-fit="3"] .fit-3,
.app[data-fit="4"] .fit-2, .app[data-fit="4"] .fit-3, .app[data-fit="4"] .fit-4 { display: none !important; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, p, ol, ul, dl, dd, fieldset, legend { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img, svg { display: block; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }

:focus-visible { outline: 3px solid #5B7FC7; outline-offset: 2px; border-radius: 6px; }
.title:focus { outline: none; }

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.noscript { padding: 24px; font-weight: 700; color: var(--danger); }

/* ---------- Estrutura do app: altura fixa = altura visível ---------- */
.app {
  --pad: max(var(--gutter), calc((100% - 480px) / 2 + var(--gutter)));
  position: relative; /* referência de offsetTop para js/fit.js */
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--white);
}

@media (min-width: 768px) {
  body { background: #E6EBF2; }
  .app { max-width: 480px; box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(14, 26, 48, .08); }
}

.app__top { flex: none; background: var(--white); padding-top: env(safe-area-inset-top); }
.app__top--tint { background: var(--blue-50); }
/* Fundo da página = cor do topo da tela: o Safari do iPhone pinta a faixa do relógio com ele */
@media (max-width: 767px) {
  html, body { background: var(--white); }
  html.top-tint, html.top-tint body { background: var(--blue-50); }
}
.app__view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.header {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--head-h);
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--line);
}
.header__logo { height: calc(var(--head-h) * .5); width: auto; }
.header--bare { border-bottom-color: transparent; background: var(--blue-50); }
.header--bare .header__logo { display: none; }

.demo-badge {
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--blue-100);
  color: var(--blue);
  font: 700 .6875rem/1.2 var(--mono);
  letter-spacing: .08em;
}

.help-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-height: 44px;
  padding: 0 16px 0 12px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue);
  font-size: 1rem;
  font-weight: 700;
}
.help-btn .icon { width: 20px; height: 20px; }
.help-btn:active { background: var(--blue-100); }

/* ---------- Progresso ---------- */
.progress { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.progress__list { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 464px; margin: 0 auto; }
.progress__step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.progress__step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 10px;
  right: calc(50% + 14px);
  width: calc(100% - 28px);
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}
.progress__dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--blue-200);
  background: var(--white);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.progress__check { width: 13px; height: 13px; stroke-width: 3.5; color: var(--white); opacity: 0; }
.progress__label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--faint);
  white-space: nowrap;
}
.progress__step.is-done .progress__dot { background: var(--blue); border-color: var(--blue); }
.progress__step.is-done .progress__check { opacity: 1; }
.progress__step.is-done::before,
.progress__step.is-current::before { background: var(--blue); }
.progress__step.is-current .progress__dot { border-color: var(--blue); box-shadow: inset 0 0 0 4px var(--white); background: var(--blue); }
.progress__step.is-current .progress__label { color: var(--ink); }
.progress__step.is-done .progress__label { color: var(--muted); }

.app[data-fit="2"] .progress, .app[data-fit="3"] .progress { padding: 7px 8px; }
.app[data-fit="3"] .progress__label { display: none; }
.app[data-fit="4"] .progress { display: none; }

/* ---------- Conexão instável ---------- */
.netbanner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--gap-sm) var(--pad) 0;
  padding: 10px 14px;
  border: 1px solid #F1C3C6;
  border-radius: 12px;
  background: var(--danger-50);
  color: var(--danger-ink);
}
.netbanner__icon { color: var(--danger); }
.netbanner__text { display: flex; flex-direction: column; flex: 1; font-size: .9375rem; line-height: 1.3; }
.netbanner__text strong { font-size: 1rem; }

/* ---------- Tela ---------- */
.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: var(--gap) var(--pad) 0;
}
/* Corpo: ocupa o espaço entre o topo e os botões. A rolagem é só uma rede de
   segurança (fit.js compacta a tela para ela nunca ser necessária). */
.screen__body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
/* Centralizado na vertical por espaçadores flexíveis (com justify-content: center,
   o topo ficaria cortado se o conteúdo passasse da altura; com margens automáticas
   no primeiro/último filho, um filho oculto quebraria a centralização). */
.screen--center .screen__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.screen--center .screen__body::before,
.screen--center .screen__body::after { content: ""; flex: 1 1 0; }
/* Os blocos nunca encolhem (seriam cortados); quem decide o tamanho é o js/fit.js */
.screen--center .screen__body > * { flex-shrink: 0; }

.screen__actions {
  flex: none;
  display: grid;
  gap: var(--gap-sm);
  padding: var(--gap) 0 calc(var(--gap) + env(safe-area-inset-bottom));
  background: var(--white);
}

.screen--enter { animation: enter .28s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } }

/* Título com o botão de voltar ao lado */
.screen__head { display: flex; align-items: center; gap: 8px; }
.title {
  font-size: var(--title);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--ink);
  text-wrap: balance;
}
.title--sm { font-size: calc(var(--title) * .82); }

.lead { margin-top: var(--gap-sm); font-size: var(--lead); color: var(--muted); text-wrap: pretty; }
.lead--strong { color: var(--ink); font-weight: 600; }
.lead--sm { font-size: calc(var(--lead) * .95); }

.meta { margin-top: var(--gap-sm); font-size: .875rem; color: var(--muted); }
.meta strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  margin-top: var(--gap);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--blue-50);
  color: var(--text);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
}
.note .icon { width: 20px; height: 20px; margin-top: 1px; color: var(--blue); }

/* ---------- Botões ---------- */
.btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--btn2-h);
  padding: 0 20px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-size: 1.0625rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background-color .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease), box-shadow .2s var(--ease);
  user-select: none;
}
.btn:active { transform: scale(.985); }
.btn .icon { width: 22px; height: 22px; }
.btn__label { display: inline-flex; align-items: center; gap: 10px; }

.btn--xl {
  min-height: var(--btn-h);
  font-size: 1.1875rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.btn--primary { background: var(--blue); color: var(--white); box-shadow: 0 6px 16px rgba(40, 63, 107, .25); }
.btn--primary:active { background: var(--blue-800); }
.btn--primary:disabled { background: #A3AEC2; box-shadow: none; cursor: not-allowed; transform: none; }
.btn--primary.is-done { background: var(--success); box-shadow: 0 6px 16px rgba(22, 128, 60, .25); }

.btn--secondary { background: var(--white); color: var(--blue); border-color: var(--blue); }
.btn--secondary:active { background: var(--blue-50); }

.btn--ghost { min-height: 44px; background: transparent; color: var(--blue); }
.btn--ghost:active { background: var(--blue-50); }

a.btn.is-disabled { opacity: .45; pointer-events: none; box-shadow: none; }

.btn .btn__spinner { position: absolute; display: none; }
.btn.is-busy { pointer-events: none; }
.btn.is-busy .btn__label { visibility: hidden; }
.btn.is-busy .btn__spinner { display: inline-block; }

@media (hover: hover) {
  .btn--primary:not(:disabled):hover { background: var(--blue-800); }
  .btn--secondary:hover, .btn--ghost:hover { background: var(--blue-50); }
}

.link {
  min-height: 40px;
  padding: 0 4px;
  color: var(--blue);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link--center { justify-self: center; }

/* Voltar: botão redondo ao lado do título */
.back {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--blue);
}
.back .icon { width: 24px; height: 24px; stroke-width: 2.5; }
.back:active { background: var(--blue-100); }

/* ---------- Indicadores ---------- */
.spinner {
  display: inline-block;
  flex: none;
  width: 20px;
  height: 20px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.spinner--lg { width: 44px; height: 44px; border-width: 4px; color: var(--blue); margin: 0 auto 8px; }
.spinner--danger { color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--gap);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--blue-50);
  color: var(--blue);
  font-size: 1rem;
  font-weight: 700;
}
.status-pill--quiet { justify-self: center; margin-top: 0; padding: 4px 16px; background: transparent; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  color: var(--white);
  font-size: .9375rem;
  font-weight: 700;
}
.chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue-200); }
.chip--live .chip__dot { background: var(--white); animation: ping-light 1.8s ease-out infinite; }
@keyframes ping-light {
  0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
  100% { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}

/* Marcas de status (sucesso, erro, documento) */
.mark { width: var(--mark); height: var(--mark); margin: 0 auto var(--gap-sm); flex: none; }
.mark--success svg { width: 100%; height: 100%; }
.mark__circle { fill: var(--success); transform-origin: center; animation: pop .45s var(--ease) both; }
.mark__check {
  fill: none;
  stroke: var(--white);
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw .4s .3s var(--ease) forwards;
}
@keyframes pop { from { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.06); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Check Lottie: a área da animação é 1,6× o círculo (espaço para o anel e os pontinhos);
   as margens negativas mantêm o mesmo espaço do check estático no layout. */
.mark--lottie {
  width: calc(var(--mark) * 1.6);
  height: calc(var(--mark) * 1.6);
  margin: calc(var(--mark) * -.3) auto calc(var(--mark) * -.3 + var(--gap-sm));
}
.mark--lottie svg { display: block; }

.mark--danger, .mark--doc {
  display: grid;
  place-items: center;
  border-radius: 50%;
}
.mark--danger { background: var(--danger-50); color: var(--danger); }
.mark--doc { background: var(--blue-50); color: var(--blue); }
.mark--danger .icon, .mark--doc .icon { width: 52%; height: 52%; stroke-width: 1.75; }

/* ---------- Tela inicial ---------- */
.screen--start { background: linear-gradient(to bottom, var(--blue-50) 0, var(--white) 200px); }
.start { display: flex; flex-direction: column; align-items: center; text-align: center; }
.start__logo { width: auto; height: clamp(34px, 7dvh, 56px); }
.start__product {
  margin-top: var(--gap-sm);
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--white);
  box-shadow: 0 0 0 1px var(--blue-100);
  color: var(--blue);
  font-size: .8125rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* Cartão: moldura da imagem do caminhão na balança (o fundo azul faz parte da imagem) */
.start__visual {
  position: relative;
  flex: none;
  width: 100%;
  margin-top: var(--gap);
  overflow: hidden;
  border-radius: 22px;
  background: #082A5A; /* mesma cor da base da imagem: a faixa do selo continua a imagem */
  box-shadow: 0 14px 32px rgba(21, 35, 63, .26);
  color: var(--white);
}
/* Em telas baixas a foto perde altura cortando o topo (logo) e mantém caminhão e balança */
.scene { display: block; width: 100%; height: auto; max-height: var(--scene-max); aspect-ratio: 1200 / 621; object-fit: cover; object-position: 50% 78%; }

/* Selo de status numa faixa abaixo da imagem, sem cobrir a balança */
.start__chip { display: flex; justify-content: center; padding: 2px 12px 12px; }
.start__chip .chip {
  padding: 5px 12px;
  font-size: .8125rem;
  background: rgba(11, 21, 40, .35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.screen--start .title { margin-top: var(--gap); }

/* Como funciona */
.howto {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  margin-top: var(--gap);
}
.howto__step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.howto__step:not(:first-child)::before {
  content: "";
  position: absolute;
  top: 20px;
  right: calc(50% + 26px);
  width: calc(100% - 52px);
  border-top: 2px dashed var(--blue-200);
}
.howto__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--blue-50);
  box-shadow: inset 0 0 0 1px var(--blue-100);
  color: var(--blue);
}
.howto__icon .icon { width: 20px; height: 20px; }
.howto__label { color: var(--muted); font-size: .8125rem; font-weight: 700; }

/* Coreografia de entrada */
.rise { animation: rise .6s var(--d, 0ms) cubic-bezier(.22, .61, .36, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* Brilho periódico no botão principal */
.btn--shine { overflow: hidden; }
.btn--shine::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .26) 50%, transparent 65%);
  background-size: 260% 100%;
  background-position: 160% 0;
  animation: shine 4.5s 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes shine { 0% { background-position: 160% 0; } 35%, 100% { background-position: -60% 0; } }
.btn__arrow { transition: transform .25s var(--ease); }
.btn--shine .btn__arrow { animation: nudge 4.5s 2.8s ease-in-out infinite; }
@keyframes nudge { 0%, 30%, 100% { transform: none; } 15% { transform: translateX(4px); } }
.start__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 16px;
  font-size: .9375rem;
  color: var(--muted);
}
.start__foot > * { white-space: nowrap; }
.start__hours { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
@media (max-width: 379px) { .start__foot { justify-content: center; } }
.start__hours .icon { width: 18px; height: 18px; }

/* ---------- Placa ---------- */
.field-label { display: block; margin-top: var(--gap); font-size: 1rem; font-weight: 700; color: var(--ink); }
.hint { margin-top: var(--gap-sm); font-size: .9375rem; color: var(--muted); }
.field-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--gap-sm);
  color: var(--danger);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}
.field-error .icon { width: 20px; height: 20px; }

.plate {
  display: inline-flex;
  flex-direction: column;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 10px;
  background: var(--white);
}
.plate__band {
  padding: 3px 0;
  background: var(--blue);
  color: var(--white);
  font-size: .6875rem;
  font-weight: 800;
  letter-spacing: .32em;
  text-align: center;
}
.plate--input { display: flex; width: 100%; margin-top: var(--gap-sm); transition: box-shadow .2s var(--ease), border-color .2s var(--ease); }
.plate--input:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(40, 63, 107, .22); }
.plate--input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(195, 38, 46, .15); }
.plate__input {
  width: 100%;
  padding: calc(var(--gap-sm) + 2px) 8px calc(var(--gap-sm) + 4px);
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: .12em;
  text-align: center;
  text-transform: uppercase;
}
.plate__input::placeholder { color: #BAC4D4; }

.plate--sm { border-width: 2px; border-radius: 6px; vertical-align: middle; }
.plate--sm .plate__band { padding: 1px 0; font-size: .5rem; letter-spacing: .28em; }
.plate__text { padding: 1px 10px 3px; color: var(--ink); font-size: 1.125rem; font-weight: 800; letter-spacing: .08em; }

/* ---------- Opções (eixos e produto) ---------- */
.group { margin-top: var(--gap); border: 0; min-width: 0; }
.group__label { margin-bottom: var(--gap-sm); font-size: 1.0625rem; font-weight: 800; color: var(--ink); }

.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.opt input:focus-visible + * { outline: 3px solid #5B7FC7; outline-offset: 2px; }

.axles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.opt--axle span {
  display: grid;
  place-items: center;
  height: var(--axle-h);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 800;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}

.cargo { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: var(--opt-h); gap: 8px; }
.cargo .opt, .cargo .opt__body { height: 100%; }
.opt__body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: left;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.opt__body .icon { width: 24px; height: 24px; color: var(--blue); stroke-width: 1.75; }
.opt__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.opt input:checked + span,
.opt input:checked + .opt__body { background: var(--blue); border-color: var(--blue); color: var(--white); }
.opt input:checked + .opt__body .icon { color: var(--white); }
.opt:active span, .opt:active .opt__body { transform: scale(.98); }

/* Tipo de pesagem: dois botões grandes com texto de apoio */
.wtype { display: grid; gap: var(--gap-sm); }
.opt--wtype .opt__body { gap: 14px; min-height: calc(var(--opt-h) + 20px); padding: 10px 16px; }
.opt--wtype .opt__body .icon { width: 30px; height: 30px; }
.opt--wtype .opt__text { display: flex; flex-direction: column; gap: 2px; -webkit-line-clamp: unset; }
.opt--wtype .opt__text strong { font-size: 1.125rem; font-weight: 800; }
.opt--wtype .opt__text small { color: var(--muted); font-size: .9375rem; font-weight: 600; }
.opt--wtype input:checked + .opt__body small { color: rgba(255, 255, 255, .82); }

/* Tara informada (opcional) */
.optional { color: var(--muted); font-weight: 600; }
.tare__field { position: relative; margin-top: 8px; }
.tare__field .input { margin-top: 0; }
.tare__input { padding-right: 56px; font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.tare__input::placeholder { color: #BAC4D4; font-weight: 700; }
.tare__unit { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.125rem; font-weight: 800; pointer-events: none; }

/* Campo obrigatório não preenchido ao tocar em Continuar */
.group.is-invalid .group__label { color: var(--danger); }
.group.is-invalid > .axles .opt span,
.group.is-invalid > .cargo .opt__body { border-color: #E9A9AD; }
.group.is-invalid > .axles, .group.is-invalid > .cargo { animation: shake .35s ease-in-out; }
@keyframes shake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.input {
  width: 100%;
  min-height: 54px;
  margin-top: 8px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 600;
  outline: 0;
}
.input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(40, 63, 107, .18); }
.input.is-invalid { border-color: var(--danger); }

/* ---------- Resumo ---------- */
.summary { width: 100%; margin-top: var(--gap); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.summary__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--row-pad) 16px; }
.summary__row + .summary__row { border-top: 1px solid var(--line); }
.summary dt { color: var(--muted); font-size: 1rem; font-weight: 600; }
.summary dd { color: var(--ink); font-size: 1.125rem; font-weight: 800; text-align: right; }
.summary--compact .summary__row { padding: calc(var(--row-pad) * .8) 16px; }
.summary--compact dd { font-size: 1rem; }

/* ---------- Pesagem ---------- */
.pulse { position: relative; flex: none; display: grid; place-items: center; width: var(--pulse); height: var(--pulse); margin: 0 auto var(--gap-sm); }
.pulse__ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--blue);
  border-radius: 50%;
  opacity: 0;
  animation: ring 2.4s ease-out infinite;
}
.pulse__ring:nth-child(2) { animation-delay: .8s; }
.pulse__ring:nth-child(3) { animation-delay: 1.6s; }
.pulse__core {
  position: relative;
  display: grid;
  place-items: center;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 10px 30px rgba(40, 63, 107, .35);
  animation: breathe 2.4s ease-in-out infinite;
}
.pulse__core .icon { width: 46%; height: 46%; stroke-width: 1.75; }
@keyframes ring { 0% { transform: scale(.55); opacity: .6; } 100% { transform: scale(1); opacity: 0; } }
@keyframes breathe { 50% { transform: scale(1.04); } }

.checksteps { display: grid; gap: var(--gap-sm); margin-top: var(--gap); text-align: left; }
.checksteps__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 1.0625rem;
  font-weight: 600;
  transition: color .3s var(--ease);
}
/* Linha entre as etapas: trilho claro + preenchimento azul que desce quando a etapa termina */
.checksteps__item:not(:last-child)::before,
.checksteps__item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 9px;
  top: calc(50% + 11px);
  width: 2px;
  height: calc(100% + var(--gap-sm) - 22px);
  border-radius: 2px;
  background: var(--blue-100);
}
.checksteps__item:not(:last-child)::after {
  background: var(--blue);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .5s .15s var(--ease);
}
.checksteps__item.is-done::after { transform: scaleY(1); }

.checksteps__dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--blue-200);
  border-radius: 50%;
  background: var(--white);
  transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.checksteps__check { width: 12px; height: 12px; stroke-width: 3.5; color: var(--white); opacity: 0; transform: scale(.4); transition: opacity .2s, transform .3s var(--ease); }
.checksteps__item.is-done { color: var(--muted); }
.checksteps__item.is-done .checksteps__dot { background: var(--blue); border-color: var(--blue); }
.checksteps__item.is-done .checksteps__check { opacity: 1; transform: none; }
.checksteps__item.is-current { color: var(--ink); font-weight: 800; }
.checksteps__item.is-current .checksteps__dot { border-color: var(--blue); animation: ping 1.6s ease-out infinite; }
.checksteps__item.is-current .checksteps__dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  transform: translate(-50%, -50%);
}

/* Animações na mudança de status */
.checksteps__item.just-done .checksteps__dot { animation: step-pop .45s var(--ease); }
.checksteps__item.just-current .checksteps__label { animation: step-in .45s var(--ease) both; }
.checksteps__item.just-current .checksteps__dot { animation: step-pop .45s var(--ease), ping 1.6s .45s ease-out infinite; }
.swap-in { display: inline-block; animation: step-in .4s var(--ease) both; }
.title.swap-in, .lead.swap-in { display: block; }
@keyframes step-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: none; } }
@keyframes step-in { from { opacity: 0; transform: translateX(-10px); } }
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(40, 63, 107, .45); }
  100% { box-shadow: 0 0 0 9px rgba(40, 63, 107, 0); }
}

/* ---------- Peso ---------- */
.weight {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-top: var(--gap-sm);
  color: var(--ink);
}
.weight__value {
  font-size: var(--weight);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.weight__unit { color: var(--muted); font-size: calc(var(--weight) * .42); font-weight: 800; }
.weight--md { margin-top: 2px; }
.weight--md .weight__value { font-size: calc(var(--weight) * .8); }

.result-card { width: 100%; margin-top: var(--gap); padding: var(--row-pad) 16px 2px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.result-card__label { color: var(--muted); font-size: .8125rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.result-card .summary { margin-top: var(--gap-sm); border: 0; border-radius: 0; }
.result-card .summary__row { padding: calc(var(--row-pad) * .8) 0; border-top: 1px solid var(--line); }

/* ---------- Pagamento ---------- */
.pay-card { margin-top: var(--gap); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.pay-card__row { display: flex; justify-content: space-between; gap: 12px; padding: var(--row-pad) 18px; }
.pay-card__row span { color: var(--muted); font-weight: 600; }
.pay-card__row strong { color: var(--ink); font-weight: 800; text-align: right; }
.pay-card__amount {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: calc(var(--row-pad) + 4px) 18px;
  background: linear-gradient(160deg, var(--blue) 0%, var(--blue-900) 100%);
  color: var(--white);
}
.pay-card__amount span { color: rgba(255, 255, 255, .8); font-size: .8125rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.pay-card__amount strong { font-size: calc(var(--weight) * .72); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.pay-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: var(--gap-sm);
  padding: calc(var(--row-pad) * .7) 16px;
  border-radius: 12px;
  background: var(--blue-50);
  font-size: 1rem;
  font-weight: 600;
}
.pay-line strong { color: var(--ink); font-size: 1.125rem; font-weight: 800; }
.pay-line--center { justify-content: center; flex-wrap: wrap; background: transparent; color: var(--muted); }

.qr {
  flex: none;
  width: var(--qr);
  height: var(--qr);
  margin: var(--gap-sm) auto 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  box-shadow: 0 4px 16px rgba(14, 26, 48, .06);
}
.qr__svg, .qr__img { width: 100%; height: 100%; }

.pixcode {
  width: 100%;
  margin-top: var(--gap-sm);
  padding: 8px 12px;
  border: 1.5px dashed var(--blue-200);
  border-radius: 12px;
  background: var(--blue-50);
  text-align: left;
}
.pixcode__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.pixcode__label { color: var(--blue); font-size: .8125rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.pixcode__value {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--text);
  font: 600 .8125rem/1.4 var(--mono);
  word-break: break-all;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  user-select: all;
}
.app[data-fit="3"] .pixcode__value, .app[data-fit="4"] .pixcode__value { -webkit-line-clamp: 1; }
.expires { color: var(--muted); font-size: .875rem; font-weight: 600; }
.expires strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Final ---------- */
.release {
  width: 100%;
  margin-top: var(--gap-sm);
  padding: calc(var(--row-pad) + 2px) 16px;
  border: 1px solid #BFE3CB;
  border-radius: 16px;
  background: var(--success-50);
  color: var(--success-ink);
  font-size: calc(var(--title) * .8);
  font-weight: 800;
  line-height: 1.3;
  text-wrap: balance;
}
.done-list { width: 100%; margin-top: var(--gap); overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.done-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--row-pad) 16px; }
.done-list li + li { border-top: 1px solid var(--line); }
.done-list span { color: var(--muted); font-weight: 600; }
.done-list strong { color: var(--ink); font-weight: 800; }
.done-list .ok { display: inline-flex; align-items: center; gap: 6px; color: var(--success); }
.done-list .ok .icon { width: 20px; height: 20px; stroke-width: 3; }

/* ---------- Erro ---------- */
.still { margin-top: var(--gap-sm); color: var(--danger); font-size: 1rem; font-weight: 700; }

/* ---------- Janelas (ajuda e "outro produto") ---------- */
.sheet {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.sheet[open] { display: flex; align-items: flex-end; justify-content: center; }
.sheet::backdrop { background: rgba(14, 26, 48, .5); }
.sheet__panel {
  width: 100%;
  max-width: 480px;
  max-height: 100%;
  overflow-y: auto;
  padding: 10px var(--gutter) calc(18px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--white);
  animation: sheet-up .28s var(--ease) both;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet__grip { display: block; width: 44px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--line); }
.sheet__title { color: var(--ink); font-size: 1.375rem; font-weight: 800; }
.sheet__steps { display: grid; gap: 6px; margin-top: 12px; padding-left: 22px; list-style: decimal; color: var(--text); font-size: 1.0625rem; font-weight: 600; }
.sheet__event { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--blue-50); font-size: 1rem; }
.sheet__event strong { color: var(--ink); }
.sheet__actions { display: grid; gap: 8px; margin-top: 16px; }
.other-sheet .input { margin-top: 12px; }

/* Enviar comprovante pelo WhatsApp */
.wa-sheet .field-label { margin-top: 12px; }
.wa-sheet__input { font-size: 1.375rem; font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.wa-sheet__input::placeholder { color: #BAC4D4; font-weight: 700; }
.wa-sheet__done { text-align: center; }
.wa-sheet__done .sheet__actions { text-align: left; }
.wa-sheet__ok {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 4px auto 12px;
  border-radius: 50%;
  background: var(--success);
  color: var(--white);
}
.wa-sheet__ok .icon { width: 34px; height: 34px; stroke-width: 3; }
.wa-sheet__done .lead strong { color: var(--ink); }

/* Troca suave entre as etapas (número → enviando → enviado) */
.wa-step.is-entering { animation: wa-in .35s var(--ease) both; }
@keyframes wa-in { from { opacity: 0; transform: translateY(10px); } }

/* Enviando: ícone do WhatsApp com anel girando */
.wa-sending { padding: 8px 0 18px; text-align: center; }
.wa-sending .lead strong { color: var(--ink); }
.wa-sending__icon { position: relative; display: grid; place-items: center; width: 96px; height: 96px; margin: 6px auto 16px; }
.wa-sending__ring {
  position: absolute;
  inset: 0;
  border: 4px solid var(--blue-100);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.wa-sending__core {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  animation: breathe 1.6s ease-in-out infinite;
}
.wa-sending__core .icon { width: 30px; height: 30px; }
.wa-dots i { font-style: normal; animation: wa-dot 1.2s infinite both; }
.wa-dots i:nth-child(2) { animation-delay: .2s; }
.wa-dots i:nth-child(3) { animation-delay: .4s; }
@keyframes wa-dot { 0%, 20% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }

/* Enviado: animação Lottie e o texto entrando logo depois do check */
.wa-done__anim { display: grid; place-items: center; width: 140px; height: 140px; margin: -6px auto 2px; }
.wa-done__anim .wa-sheet__ok { margin: 0; }
.wa-sheet__done:not(.is-static) .wa-done__title { animation: wa-in .4s .35s var(--ease) both; }
.wa-sheet__done:not(.is-static) .wa-done__text { animation: wa-in .4s .5s var(--ease) both; }

/* Comprovante aberto dentro do app, em tela cheia */
.viewer {
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: #E6EBF2;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(14, 26, 48, .6); }
.viewer__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: calc(8px + env(safe-area-inset-top)) var(--gutter) 8px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.viewer__title { flex: 1; color: var(--ink); font-size: 1.125rem; font-weight: 800; }
.viewer__close {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 18px 0 14px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--white);
  font-size: 1rem;
  font-weight: 800;
}
.viewer__close .icon { width: 20px; height: 20px; stroke-width: 2.5; }
.viewer__frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #E6EBF2; }
.viewer__actions { flex: none; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); }

/* ---------- Telas muito estreitas ---------- */
@media (max-width: 359px) {
  :root { --gutter: 16px; }
  .plate__input { font-size: 2.125rem; }
  .axles { gap: 6px; }
  .progress__label { font-size: .6875rem; }
}

/* ---------- Movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .mark__check { stroke-dashoffset: 0; }
}
