/* 28/10/2026: Entrada de compras (entrada-tela.js) */
.en {
  max-width: 1200px;
}
.en-card {
  background: #fff;
  border: 1px solid #dfe8e2;
  border-radius: 14px;
  padding: 16px 18px;
  margin: 0 0 14px;
  min-width: 0;
}
.en-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #163a5a;
}
.en-mut {
  color: #5a6b7a;
  font-size: 13px;
}
.en-erro {
  color: #b3261e;
  font-size: 13px;
  font-weight: 600;
  margin: 6px 0;
}
.en-erro:empty {
  display: none;
}
.en-ok {
  color: #1f7a57;
  font-weight: 700;
}
.en-feito {
  background: #eef8f1;
  border: 1px solid #bfe3cc;
  color: #14513a;
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
  font-weight: 600;
}
.en-cab {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.en-cab > label {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #44566a;
  font-weight: 600;
}
.en-cab select,
.en-cab input:not([type='checkbox']) {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cdd8d1;
  font-size: 14px;
  min-width: 150px;
}
.en-cab select {
  min-width: 230px;
}
.en-sn small {
  display: block;
  font-weight: 400;
  color: #5a6b7a;
}
.en-cab-botoes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.en-duas {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.en-leitor {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  font-size: 15px;
  border-radius: 10px;
  border: 2px solid #1f7a57;
}
.en-achados {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}
.en-achados button {
  border: 1px solid #cdd8d1;
  background: #f6faf7;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.en-achados small {
  color: #5a6b7a;
}
.en-novo {
  background: #fff8e6;
  border: 1px solid #f0d58a;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 14px;
}
.en-novo-campos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.en-novo-campos input {
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid #cdd8d1;
  font-size: 14px;
  min-width: 120px;
  flex: 1;
}
.en-tab {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}
.en-tab th {
  text-align: left;
  font-size: 12px;
  color: #5a6b7a;
  font-weight: 600;
  padding: 4px 6px;
  border-bottom: 1px solid #e5ece7;
}
.en-tab td {
  white-space: normal;
  padding: 6px;
  border-bottom: 1px solid #f0f4f1;
  vertical-align: top;
}
.en-prod {
  min-width: 160px;
}
.en-muda {
  display: block;
}
.en-tab td small {
  display: block;
  color: #7a8a97;
  font-size: 12px;
}
.en-tab input {
  width: 58px;
  padding: 6px 7px;
  border-radius: 7px;
  border: 1px solid #cdd8d1;
  font-size: 14px;
}
.en-tab input.en-totlinha {
  width: 72px;
  text-align: right;
  font-weight: 700;
}
.en-tab input.en-pval {
  width: 86px;
  text-align: right;
}
.en-tab input[type='date'] {
  width: auto;
}
.en-tab input.erro,
.en-total.erro {
  border-color: #b3261e;
  background: #fff3f2;
}
.en-up {
  color: #b3261e;
  font-size: 12px;
  font-weight: 600;
}
.en-down {
  color: #1f7a57;
  font-size: 12px;
  font-weight: 600;
}
.en-margem {
  color: #8a5a00;
  background: #fff8e6;
  border-radius: 6px;
  padding: 3px 6px;
  margin-top: 4px;
  font-size: 12px;
}
.en-x {
  border: 0;
  background: none;
  color: #9aa7b2;
  cursor: pointer;
  font-size: 15px;
}
.en-x:hover {
  color: #b3261e;
}
.en-lin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 6px 0;
  font-size: 14px;
}
.en-total {
  width: 110px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid #cdd8d1;
  font-size: 14px;
  text-align: right;
}
.en-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.en-chip {
  border: 1.5px solid #cdd8d1;
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #44566a;
}
.en-chip.sel {
  border-color: #1f7a57;
  background: #eef8f1;
  color: #14513a;
}
.en-inline {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: #44566a;
  font-weight: 600;
}
.en-inline select {
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid #cdd8d1;
  font-size: 14px;
  max-width: 190px;
}
.en-ja {
  background: #fff3f2;
  border: 1px solid #f2c2bd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  margin: 6px 0;
}
.en-ja-ok {
  background: #eef8f1;
  border-color: #bfe3cc;
}
.en-ja-botoes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.en-link {
  border: 0;
  background: none;
  color: #1f5e8a;
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.en-res {
  background: #f6faf7;
  border: 1px solid #dfe8e2;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
}
.en-res ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.en-confirmar {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  font-size: 16px;
}
.en-descartar {
  display: block;
  margin: 12px auto 0;
  color: #b3261e;
}
.en-corr {
  background: #eef4fb;
  border: 1px solid #c4d8ee;
  color: #1d4d7a;
  border-radius: 12px;
  padding: 10px 14px;
  margin: 0 0 14px;
  font-weight: 600;
}
.en-hist {
  margin-top: 16px;
}
.en-hist .en-tab td {
  vertical-align: middle;
}
.en-hist .en-tab td small {
  display: block;
}
.en-tag {
  background: #eef4fb;
  color: #1d4d7a;
  border-radius: 6px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
}
.en-hist-itens ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: #44566a;
}
.en-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.en-mg {
  font-size: 14px;
}
.en-mg.bom {
  color: #1f7a57;
}
.en-mg.caiu {
  color: #9a6400;
}
.en-mg.ruim {
  color: #b3261e;
}
.en-tab td small.en-era:empty {
  display: none;
}
.en-tab input.en-preco-novo {
  border-color: #1f7a57;
  background: #eef8f1;
  font-weight: 700;
}
.en-usar {
  border: 1px solid #c9a24a;
  background: #fff;
  color: #6b4a00;
  border-radius: 6px;
  padding: 1px 8px;
  margin-left: 4px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 900px) {
  .en-duas {
    grid-template-columns: minmax(0, 1fr);
  }
  .en-cab-botoes {
    margin-left: 0;
  }
}
@media (max-width: 560px) {
  /* produtos em cartões: nome em cima, Qtd · Custo · Total embaixo */
  .en-tab tr:first-child:has(th) {
    display: none;
  }
  .en-tab tr[data-en-linha] {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: 2px 8px;
    border-bottom: 1px solid #e5ece7;
    padding: 6px 0;
  }
  .en-tab tr[data-en-linha] td {
    border: 0;
    padding: 2px 0;
  }
  .en-tab tr[data-en-linha] td.en-prod {
    grid-column: 1 / -1;
  }
  .en-tab tr[data-en-linha] td[data-rot]::before {
    content: attr(data-rot);
    display: block;
    font-size: 11px;
    color: #7a8a97;
  }
  .en-hist .en-tab tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    border-bottom: 1px solid #e5ece7;
    padding: 6px 0;
  }
  .en-hist .en-tab td {
    border: 0;
    padding: 2px 0;
  }
  .en-hist .en-tab tr.en-hist-itens td {
    grid-column: 1 / -1;
  }
  .en-hist .en-tab td.en-prod {
    grid-column: 1 / -1;
    order: -1;
    font-weight: 600;
  }
  .en-esc {
    display: none;
  }
  .en-tab input {
    width: 100%;
    box-sizing: border-box;
  }
  .en-cab select,
  .en-cab input:not([type='checkbox']) {
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }
  .en-cab > label {
    flex: 1 1 100%;
  }
}
/* 30/10: impostos da nota espalhados no custo */
.en-imp {
  display: block;
  color: #8a5a00;
  font-size: 11.5px;
}
.en-lin span small.en-mut {
  display: block;
  font-size: 11.5px;
}
/* 04/11 (chat do visual, regra das telas — docs/visual-telas.md): quadro branco → cards cinza-azulados (só
   informação) → dentro dos cards tudo branco (campos, tabelas, totais). O cabeçalho cabe numa linha no computador. */
.en-quadro {
  background: #fff;
  border: 1px solid #e2e7ee;
  border-radius: 14px;
  padding: 16px 18px 4px;
  box-shadow: 0 1px 3px rgba(18, 63, 90, 0.05);
}
.en-quadro .en-card,
.en-quadro .en-res {
  background: var(--vis-neutro-bg);
  border-color: color-mix(in srgb, var(--vis-neutro) 18%, #fff);
}
.en-quadro .en-res {
  margin: 0 0 4px;
}
.en-quadro .en-hist {
  margin-top: 0;
}
.en-quadro .en-tab,
.en-quadro .en-somas {
  background: #fff;
  border: 1px solid #e2e7ee;
  border-radius: 10px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}
.en-quadro .en-tab th {
  background: #fff;
}
.en-quadro .en-tab tr:last-child > td {
  border-bottom: 0;
}
.en-quadro .en-somas {
  margin-top: 10px;
  padding: 4px 12px;
}
.en-quadro .en-somas .en-lin + .en-lin {
  border-top: 1px solid #f0f4f1;
}
.en-quadro .en-cab {
  flex-wrap: nowrap;
}
.en-quadro .en-cab select {
  min-width: 200px;
}
.en-quadro .en-cab input:not([type='checkbox']) {
  min-width: 120px;
}
.en-quadro .en-cab-botoes .button {
  white-space: nowrap;
}
.en-quadro .en-sn {
  background: #fff;
}
@media (max-width: 1180px) {
  .en-quadro .en-cab {
    flex-wrap: wrap;
  }
}
@media (max-width: 760px) {
  .en-quadro {
    padding: 10px 10px 2px;
  }
}
@media (min-width: 901px) {
  .en-quadro .en-duas {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .en-quadro .en-card,
  .en-quadro .en-res {
    padding: 12px 10px;
  }
  .en-quadro .en-cab select,
  .en-quadro .en-cab input:not([type='checkbox']) {
    min-width: 0;
  }
}
@media (max-width: 560px) {
  .en-quadro .en-tab,
  .en-quadro .en-tab tbody {
    display: block;
    overflow: visible;
  }
  .en-quadro .en-tab tr[data-en-linha],
  .en-quadro .en-hist .en-tab tr {
    padding: 6px 8px;
  }
  .en-quadro .en-tab tr[data-en-linha] td,
  .en-quadro .en-tab tr[data-en-linha] td:first-child {
    padding-left: 0;
    padding-right: 0;
  }
  .en-quadro .en-tab tr[data-en-linha] input {
    width: 100%;
    box-sizing: border-box;
  }
}
.en-quadro .en-tab th,
.en-quadro .en-tab td {
  padding-left: 4px;
  padding-right: 4px;
}
.en-quadro .en-tab th:first-child,
.en-quadro .en-tab td:first-child {
  padding-left: 8px;
}
/* 04/11 (Thauand: "informações amontoadas na linha"): itens de uma entrada aberta numa tabelinha alinhada. */
.en-hist-itens > td {
  padding: 4px 8px 12px !important;
  background: #fff;
}
.en-itens {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #33444f;
}
.en-itens th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: #5a6b7a;
  padding: 5px 8px;
  background: var(--vis-neutro-bg);
  border-bottom: 1px solid #e2e7ee;
}
.en-itens td {
  padding: 5px 8px;
  border-bottom: 1px solid #f0f4f1;
  vertical-align: top;
}
.en-itens td small {
  display: block;
  font-size: 11.5px;
  color: #7a8a97;
}
.en-itens .n {
  text-align: right;
  white-space: nowrap;
}
.en-itens tbody tr:nth-child(even) td {
  background: #fafbfc;
}
.en-itens tfoot td {
  border-bottom: 0;
  border-top: 1px solid #e2e7ee;
  color: #5a6b7a;
  padding-top: 7px;
}
.en-quadro .en-hist .en-tab td[data-rot='Chegou'] {
  font-size: 13.5px;
  color: #33444f;
  white-space: nowrap;
}
.en-quadro .en-hist .en-tab td.en-prod {
  font-size: 14px;
  font-weight: 600;
  color: #163a5a;
}
.en-quadro .en-hist .en-tab td[data-rot='Total'] b {
  font-size: 14px;
}
@media (max-width: 560px) {
  .en-quadro .en-hist .en-tab tr.en-hist-itens {
    display: block;
    padding: 0;
  }
  .en-quadro .en-hist .en-tab tr.en-hist-itens > td {
    display: block;
    padding: 4px 0 10px !important;
  }
  .en-itens th,
  .en-itens td {
    padding: 5px 4px;
  }
}
@media (max-width: 560px) {
  /* a tabelinha de itens fica tabela no celular (a regra da lista de entradas vale só para as linhas dela) */
  .en-quadro .en-hist .en-tab table.en-itens {
    display: table;
    width: 100%;
  }
  .en-quadro .en-hist .en-tab table.en-itens thead {
    display: table-header-group;
  }
  .en-quadro .en-hist .en-tab table.en-itens tbody {
    display: table-row-group;
  }
  .en-quadro .en-hist .en-tab table.en-itens tfoot {
    display: table-footer-group;
  }
  .en-quadro .en-hist .en-tab table.en-itens tr {
    display: table-row;
    padding: 0;
    border: 0;
  }
  .en-quadro .en-hist .en-tab table.en-itens th,
  .en-quadro .en-hist .en-tab table.en-itens td {
    display: table-cell;
    order: 0;
    font-weight: inherit;
  }
  .en-quadro .en-hist .en-tab table.en-itens td::before {
    content: none;
  }
}
/* 04/11 (piloto Amandinha): linha de brinde na Entrada de compras */
.en-brinde {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
  font-size: 13px;
  color: #4b5b6b;
  cursor: pointer;
}
.en-brinde input {
  width: auto;
  margin: 0;
}
.en-brinde-tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fdf1d8;
  color: #8a5a00;
  font-weight: 700;
  font-size: 13px;
}
.en-brinde-tag + small {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}
/* 05/11 (piloto Amandinha): o produto que acabou de ser bipado vai para o alto da lista, destacado */
.en-tab tr.en-bipado td {
  background: #eaf7f0;
}
.en-tab tr.en-bipado td:first-child {
  box-shadow: inset 4px 0 0 #1f9d6b;
}
/* 20/11 (estoque próprio): previsões já lançadas que a compra sem nota pode pagar. */
.en-prevs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.en-prevs .en-chip {
  text-align: left;
}
/* 20/11: busca ao digitar — lista embaixo do campo, uma por linha, a escolhida (↑ ↓) destacada. */
.en-achados:empty {
  display: none;
}
.en-achados {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #cdd8d1;
  border-radius: 10px;
  padding: 4px;
  background: #fff;
}
.en-achados button {
  text-align: left;
  border-color: transparent;
  background: #fff;
}
.en-achados button.sel,
.en-achados button:hover {
  background: #e3f3ea;
  border-color: #1f7a57;
}

/* 21/11 (piloto Amandinha): cabeçalho numa linha só — fornecedor, nº da nota (com a chave "sem nota"), chegou em,
   total da nota, impostos e frete, repetir */
.en-cab > label.en-topo-valor {
  position: relative;
}
.en-cab > label.en-topo-valor input,
.en-quadro .en-cab > label.en-topo-valor input {
  min-width: 0;
  width: 110px;
  text-align: right;
}
.en-topo-selo {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 3px;
  font-size: 12px;
  white-space: nowrap;
}
.en-num {
  margin-bottom: 7px; /* igual aos outros rótulos do cabeçalho (alinha os campos) */
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: #44566a;
  font-weight: 600;
}
.en-num-rot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.en-sn-chave {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  font-size: 12px;
  color: #5a6b7a;
  cursor: pointer;
}
.en-sn-chave input {
  margin: 0;
}
.en-cab input[data-en-dia] {
  min-width: 0;
}
.en-quadro .en-cab-botoes .button {
  padding: 8px 12px;
}
.en-sn-aviso {
  margin: -4px 0 10px;
  font-size: 13px;
}
.en-resumo {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 6px 18px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4f8f5;
  font-size: 14px;
  color: #44566a;
}
.en-resumo b {
  color: #12324a;
  margin-left: 4px;
}
.en-salvo {
  font-size: 12px;
  font-weight: 500;
  color: #2f7a4f;
  margin-left: 8px;
}
td.en-acoes > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.en-cab [data-en-selo] {
  white-space: nowrap;
}
.en-pronto {
  border: 1px solid #b9d9c4;
  background: #fff;
  color: #2f7a4f;
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 700;
  cursor: pointer;
}
.en-pronto:hover,
.en-pronto.feito {
  background: #2f7a4f;
  color: #fff;
}
tr.en-feito > td {
  background: #f1faf4;
}
