/* Planet Aduana — calculadora de cubagem (/cubagem). Usa os tokens e as classes do style.css
   (.grupo, .campo, .entrada, .resultado, .detalhe, .calculo, .chamada, .resultado-fixo). */

.pagina-cubagem [hidden] { display: none !important; }

.cub-oculto {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Grade: volumes e resultados por modal à esquerda, resumo fixo à direita ---------- */

.cubagem {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; align-items: start;
  grid-template-areas: "form resumo" "modais resumo";
}
.cubagem__form { grid-area: form; display: grid; gap: 20px; min-width: 0; }
.cub-resumo { grid-area: resumo; }
.transportes { grid-area: modais; }

/* ---------- Lista de volumes (no celular: um cartão por linha) ---------- */

.volumes { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.volume {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 10px; align-items: end;
  padding: 14px; border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo-2);
}
/* posições fixas: com o botão de remover oculto, o primeiro campo não sobe para a linha do título */
.volume__titulo { grid-column: 1 / 5; grid-row: 1; align-self: center; font-weight: 600; color: var(--marinho); }
.volume__campo:nth-of-type(1) { grid-area: 2 / 1 / 3 / 3; }
.volume__campo:nth-of-type(2) { grid-area: 2 / 3 / 3 / 5; }
.volume__campo:nth-of-type(3) { grid-area: 2 / 5 / 3 / 7; }
.volume__campo:nth-of-type(4) { grid-area: 3 / 1 / 4 / 4; }
.volume__campo:nth-of-type(5) { grid-area: 3 / 4 / 4 / 7; }
.volume__campo label { font-size: .8125rem; line-height: 1.3; }
.volume .campo input { padding-inline: 10px; font-variant-numeric: tabular-nums; }
.volume .campo .entrada--sufixo input { padding-left: 10px; padding-right: 30px; }
.volume .entrada__sufixo { right: 10px; font-size: .875rem; }

.volume__remover {
  grid-column: 5 / -1; grid-row: 1; justify-self: end; align-self: center;
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--borda-campo); border-radius: 10px; background: #fff; color: var(--texto-3);
  cursor: pointer; transition: color .15s, border-color .15s;
}
.volume__remover .icone { width: 20px; height: 20px; }
.volume__remover:hover { color: #b3261e; border-color: #b3261e; }

.volume__resumo { grid-column: 1 / -1; grid-row: 4; margin-top: -4px; font-size: .8125rem; color: var(--texto-3); font-variant-numeric: tabular-nums; }
.volume__resumo--erro { color: #b3261e; font-weight: 500; }

/* Até 439px, três medidas lado a lado ficam estreitas demais: comprimento e largura, altura, e depois quantidade e peso. */
@media (max-width: 439px) {
  .volume__campo:nth-of-type(1) { grid-area: 2 / 1 / 3 / 4; }
  .volume__campo:nth-of-type(2) { grid-area: 2 / 4 / 3 / 7; }
  .volume__campo:nth-of-type(3) { grid-area: 3 / 1 / 4 / 4; }
  .volume__campo:nth-of-type(4) { grid-area: 4 / 1 / 5 / 4; }
  .volume__campo:nth-of-type(5) { grid-area: 4 / 4 / 5 / 7; }
  .volume__resumo { grid-row: 5; }
}

.volumes__acoes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 18px; }
.volumes__acoes .botao { min-height: 44px; padding: 10px 20px; }
.cub-limpar {
  min-height: 44px; padding: 8px 4px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .9375rem; font-weight: 600; color: var(--texto-2);
  text-decoration: underline; text-underline-offset: 3px;
}
.cub-limpar:hover { color: var(--indigo); }
.cub-status { margin: 6px 0 0; font-size: .875rem; color: var(--texto-2); }
.cub-status:empty { margin: 0; }

/* A partir de 761px: uma linha por volume, como numa tabela; os rótulos aparecem só na primeira.
   Abaixo disso, os campos da linha ficariam estreitos demais para valores como "1.250,5". */
@media (min-width: 761px) {
  .volume__campo label { white-space: nowrap; }
  .volumes { gap: 10px; }
  .volume {
    grid-template-columns: 32px repeat(3, minmax(0, 1fr)) minmax(0, .9fr) minmax(0, 1.25fr) 44px;
    gap: 6px 10px; padding: 0; border: 0; border-radius: 0; background: none;
  }
  .volume__titulo {
    grid-column: auto; grid-row: auto; align-self: end;
    display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 8px; border-radius: 50%;
    font-size: .875rem; font-weight: 700; color: var(--indigo); background: color-mix(in srgb, var(--indigo) 9%, white);
  }
  .volume__palavra {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .volume__campo:nth-of-type(n) { grid-area: auto; }
  .volume + .volume .volume__campo label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .volume__remover { grid-column: auto; grid-row: auto; align-self: end; margin-bottom: 2px; }
  .volume__resumo { grid-column: 2 / -1; grid-row: auto; margin-top: 0; }
  .volume + .volume { padding-top: 10px; border-top: 1px solid var(--linha); }
}

/* ---------- Resumo (coluna da direita) ---------- */

.cub-alerta {
  margin-top: 14px; padding: 10px 14px; border-left: 3px solid #e6be58; border-radius: 4px 10px 10px 4px;
  background: #fdf5e1; color: #5c4300; font-size: .875rem;
}
.cub-resumo .resultado__sub:empty { display: none; }
.cub-base th span { display: block; font-size: .8125rem; color: var(--texto-3); }
.cub-base tbody tr:first-child th { color: var(--texto-2); }
.cub-base tbody tr:first-child td { color: var(--texto); font-weight: 600; }
.cub-base td { vertical-align: top; }
a.resultado__enviar { display: flex; }

/* ---------- Resultado por modal ---------- */

.transportes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.transportes__titulo { grid-column: 1 / -1; margin-top: 12px; font-size: 1.5rem; letter-spacing: -.01em; }

.transporte {
  position: relative; min-width: 0; padding: 24px; background: #fff;
  border: 1px solid var(--linha); border-radius: var(--raio);
}
.transporte::before {
  content: ""; position: absolute; top: -1px; left: 24px; width: 40px; height: 3px;
  border-radius: 0 0 3px 3px; background: var(--acento);
}
.transporte--largo { grid-column: 1 / -1; }
.transporte--alto { grid-row: span 2; }
.transporte__topo { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.transporte__icone {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px;
  color: var(--acento); background: color-mix(in srgb, var(--acento) 10%, white);
}
.transporte h3 { font-size: 1.1875rem; }
.transporte__regra { margin-top: 4px; font-size: .875rem; line-height: 1.45; color: var(--texto-3); }
.transporte__nota { margin-top: 12px; font-size: .875rem; color: var(--texto-2); }
.transporte__nota:empty { display: none; }
.transporte__extra { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--borda-campo); }
.transporte__extra h4 { margin: 0 0 6px; font-size: 1rem; font-weight: 600; line-height: 1.3; color: var(--marinho); }
.transporte__extra h4 span { display: block; font-size: .875rem; font-weight: 400; color: var(--texto-3); }

.cub-valores { display: grid; margin: 0; }
.cub-valores > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 8px 0; border-top: 1px solid var(--linha); font-size: .9375rem;
}
.cub-valores > div:first-child { border-top: 0; padding-top: 0; }
.cub-valores dt { color: var(--texto-2); }
.cub-valores dd { margin: 0; font-weight: 600; color: var(--texto); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cub-valores > .cub-valores__destaque { margin-top: 2px; padding-top: 10px; border-top: 2px solid var(--marinho); }
.cub-valores__destaque dt { font-weight: 600; color: var(--marinho); }
.cub-valores__destaque dd { font-size: 1.1875rem; color: var(--marinho); }

/* ---------- Contêineres (FCL) ---------- */

.cub-aproveitamento { margin-bottom: 20px; }
.cub-aproveitamento .entrada { width: 128px; }
.cub-aproveitamento .campo__nome { max-width: 40em; }
.cub-erro { font-size: .875rem; font-weight: 500; color: #b3261e; }

.equipamentos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 12px; margin: 0; padding: 6px 0 0; list-style: none; }
.equip {
  position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 18px 16px 16px; border: 1px solid var(--linha); border-radius: 12px; background: var(--fundo-2);
}
.equip--sugerido { background: #fff; border-color: var(--indigo); box-shadow: inset 0 0 0 1px var(--indigo); }
.equip__topo { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.equip__nome { margin: 0; font-size: 1.0625rem; font-weight: 600; line-height: 1.3; color: var(--marinho); }
.equip__nome span { font-size: .875rem; font-weight: 400; color: var(--texto-3); }
.equip__selo {
  position: absolute; top: -11px; left: 14px; padding: 2px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--indigo);
}
.equip__qtd { font-size: .875rem; color: var(--texto-2); }
.equip__qtd strong {
  margin-right: 2px; font-size: 1.75rem; font-weight: 600; line-height: 1.15;
  color: var(--indigo); font-variant-numeric: tabular-nums;
}
.equip__linhas { display: grid; gap: 4px; }
.equip__ocupacao { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .875rem; color: var(--texto-2); }
.equip__ocupacao strong { font-weight: 600; color: var(--marinho); font-variant-numeric: tabular-nums; }
.equip__detalhe { margin-top: 2px; font-size: .8125rem; line-height: 1.4; color: var(--texto-3); font-variant-numeric: tabular-nums; }
.equip__detalhe + .equip__ocupacao { margin-top: 10px; }

.equip__medidor {
  display: block; width: 100%; height: 8px; margin: 0; border: 0; border-radius: 4px;
  background: var(--linha); -webkit-appearance: none; appearance: none;
}
.equip__medidor::-webkit-meter-inner-element { display: block; }
.equip__medidor::-webkit-meter-bar { height: 8px; border: 0; border-radius: 4px; background: var(--linha); }
.equip__medidor::-webkit-meter-optimum-value { border-radius: 4px; background: var(--indigo); }
.equip__medidor::-moz-meter-bar { border-radius: 4px; background: var(--indigo); }

.equip__aviso { font-size: .875rem; color: #8c1d18; }
.equip__specs { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--linha); font-size: .8125rem; line-height: 1.45; color: var(--texto-3); }

/* ---------- Como calculamos ---------- */

.pagina-cubagem .calculo__texto { min-width: 0; } /* a tabela larga rola dentro da caixa, sem alargar a página */

.cub-rolagem { margin-top: 14px; overflow-x: auto; border: 1px solid var(--linha); border-radius: var(--raio); background: #fff; }
.cub-tabela { width: 100%; min-width: 560px; border-collapse: collapse; font-size: .9375rem; }
.cub-tabela th, .cub-tabela td { padding: 10px 16px; text-align: left; white-space: nowrap; border-top: 1px solid var(--linha); }
.cub-tabela thead th { border-top: 0; font-size: .8125rem; font-weight: 600; color: var(--texto-3); background: var(--fundo-2); }
.cub-tabela tbody th { font-weight: 600; color: var(--marinho); }
.cub-tabela td { color: var(--texto-2); font-variant-numeric: tabular-nums; }

.cub-chamada { margin-top: clamp(48px, 7vw, 88px); }
.cub-chamada .chamada { margin-top: 0; }

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
  /* A barra fixa de resumo ocupa o pé da tela: o campo que recebe o foco para acima dela, sem ficar escondido. */
  html:has(> body.pagina-cubagem) { scroll-padding-bottom: 104px; }
  .cubagem { grid-template-columns: minmax(0, 1fr); grid-template-areas: "form" "resumo" "modais"; }
  .pagina-cubagem .whatsapp-flutuante { display: none; }
  .pagina-cubagem .rodape__base { padding-bottom: 96px; }
}
@media (min-width: 700px) and (max-width: 1100px) {
  .cub-resumo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0 48px; align-items: start; }
  .cub-resumo .detalhe { margin-top: 0; }
}
@media (max-width: 900px) {
  .equipamentos { grid-template-columns: minmax(0, 1fr); }
  .equip__linhas { max-width: 32rem; }
}
@media (max-width: 720px) {
  .transportes { grid-template-columns: minmax(0, 1fr); }
  .transporte--alto { grid-row: auto; }
}
@media (max-width: 640px) {
  .transporte { padding: 22px 18px; }
  .transporte::before { left: 18px; }
}
