/* ── Trocas Etapa 2: aba "Trocas" do estoquista + espelhos impressos ─────────────────────
   Na tela: reaproveita as classes do trocas.css (tr-card, tr-linha, tr-acoes, tr-stepper, tr-msg,
   tr-erro, tr-parada) e só acrescenta o que é da aba (te-*). Só variáveis do style.css.
   Na impressão (@media print): com body.te-imprimindo (posto pelo trocasEstoqView.imprimir) a
   página mostra SÓ #te-espelhos -- A4, só preto, letra ≥ 12 pt, 4 espelhos por folha, cada um
   inteiro (break-inside: avoid) com a linha de corte tracejada "✂". Sem a classe, nada muda na
   impressão de nenhuma outra tela. O tamanho/margem da folha (A4 retrato, 8/10 mm) NÃO fica aqui:
   regra de página aqui valeria para QUALQUER impressão do app (E2-R13). O trocasEstoqView injeta um
   <style id="te-espelhos-pagina"> no <head> só enquanto imprime os espelhos e o tira no afterprint. */

#te-espelhos { display: none; }

#estoq-trocas-tab .te-topo {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem;
}
#estoq-trocas-tab .te-topo .te-imprimir { margin-left: auto; }
#estoq-trocas-tab .btn[disabled], #estoq-trocas-tab .btn-sm[disabled] { opacity: 0.55; cursor: not-allowed; }
.te-bloco { margin-bottom: 1.25rem; min-width: 0; }
.te-bloco-cab { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 0.75rem; }
.te-marcar-todas { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; min-height: 44px; }
.te-marca { display: flex; align-items: center; gap: 0.5rem; min-width: 0; cursor: pointer; }
.te-marca strong { min-width: 0; overflow-wrap: anywhere; }
.te-marca input, .te-marcar-todas input { width: 20px; height: 20px; flex: none; accent-color: var(--primary); }
.te-card .tr-card-top > span { font-size: 0.85rem; }
.te-sem-pedido { font-weight: 700; color: var(--danger); }
.te-pedido select {
  min-height: 36px; padding: 0.2rem 0.4rem; border-radius: 6px; border: 1px solid var(--border-color);
  background: var(--bg-secondary); color: var(--text-primary); font-family: inherit;
}
.te-ajuste-linha {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 0.75rem;
  padding: 0.45rem 0; border-bottom: 1px solid var(--border-color);
}
.te-ajuste-linha > span { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; font-size: 0.88rem; }
.te-ajuste-linha .tr-stepper button[disabled] { opacity: 0.4; cursor: not-allowed; }
.te-ok { color: var(--success); font-weight: 600; font-size: 0.9rem; margin: 0.3rem 0; }
.te-aviso { color: var(--warning); font-weight: 600; font-size: 0.9rem; margin: 0.3rem 0; }
.te-card .tr-acoes { flex-wrap: wrap; }
.te-card .tr-acoes .btn { min-height: 44px; }
/* computador (o estoquista usa): cartões lado a lado */
@media (min-width: 900px) {
  .te-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 0.6rem; align-items: start; }
  .te-grade .tr-card { margin-bottom: 0; }
}

@media print {
  /* o style.css prende html/body em 100% de altura com overflow hidden (app de tela cheia): na impressao
     isso cortaria tudo depois da 1a folha */
  html.te-imprimindo, html.te-imprimindo body { height: auto !important; overflow: visible !important; }
  body.te-imprimindo { background: #fff !important; color: #000 !important; margin: 0 !important; padding: 0 !important; }
  body.te-imprimindo > *:not(#te-espelhos) { display: none !important; }
  body.te-imprimindo #te-espelhos { display: block !important; }
  #te-espelhos, #te-espelhos * {
    color: #000 !important; background: transparent !important; border-color: #000 !important;
    box-shadow: none !important; text-shadow: none !important;
  }
  #te-espelhos { font-family: Arial, Helvetica, sans-serif; font-size: 12pt; line-height: 1.3; }
  /* 4 por folha: A4 297 mm - 16 mm de margem = 281 mm; 4 x (64 mm + 4 mm do corte) = 272 mm */
  .te-espelho {
    break-inside: avoid; page-break-inside: avoid; box-sizing: border-box;
    min-height: 64mm; padding-top: 1.5mm; display: flex; flex-direction: column;
  }
  .te-esp-cab { display: flex; justify-content: space-between; align-items: baseline; font-size: 14pt; }
  .te-esp-ped { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8mm; }
  .te-esp-tab { width: 100%; border-collapse: collapse; margin: 1.5mm 0; }
  .te-esp-tab th, .te-esp-tab td { border: 0.3mm solid #000; padding: 0.5mm 1.5mm; font-size: 12pt; text-align: left; vertical-align: top; }
  .te-esp-tab th { font-weight: 700; }
  .te-esp-tab td:nth-child(2), .te-esp-tab th:nth-child(2) { text-align: center; width: 14mm; }
  .te-canhoto { margin-top: auto; display: flex; flex-wrap: wrap; gap: 2.5mm 6mm; padding-top: 2mm; }
  .te-canhoto i { display: inline-block; width: 20mm; height: 0; border-bottom: 0.3mm solid #000; vertical-align: baseline; }
  .te-canhoto i.te-longo { width: 58mm; }
  .te-corte { position: relative; height: 0; margin-top: 3.5mm; border-top: 0.4mm dashed #000; }
  #te-espelhos .te-corte span { position: absolute; left: 3mm; top: -2.6mm; line-height: 1; font-size: 12pt; padding: 0 1mm; background: #fff !important; }
}
