body {
  font-family: 'Poppins', sans-serif;
  margin: 0 auto;
  padding: 20px;
}

h2 {
  font-family: 'Oswald', sans-serif;
  text-align: center;
  margin-bottom: 30px;
}

label {
  font-weight: 600;
  display: block;
  margin-top: 15px;
}

input,
textarea,
select {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  box-sizing: border-box;
}

.botoes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.botoes button {
  background-color: #3a4f85;
  color: white;
  font-weight: normal;
  border: none;
  padding: 10px 20px;
  width: 200px;
  cursor: pointer;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 30px;
}

th,
td {
  border: 1px solid #ccc;
  padding: 8px;
}

#tabela th:nth-child(1),
#tabela td:nth-child(1) {
  width: 40%;
}

#tabela td:nth-child(2) input {
  width: 80px;
  text-align: center;
}

#tabela td:nth-child(3) input,
#tabela td:nth-child(4) input {
  text-align: right;
}

#tabela th:nth-child(5),
#tabela td:nth-child(5) {
  width: 15%;
}

.observacao-total {
  display: flex;
  flex-wrap: wrap;
  margin-top: 10px;
  gap: 10px;
}

.observacao-total textarea {
  flex: 1 1 60%;
  min-width: 200px;
}

.observacao-total .total-box {
  flex: 1 1 35%;
  border: 1px solid #ccc;
  padding: 10px;
}

.mensagem {
  font-weight: bold;
  margin-top: 30px;
  color: red;
}

.instrucoes {
  font-weight: bold;
  font-size: 15px;
  line-height: 2.0;
  margin-top: 30px;
}

/* Logo centralizada e responsiva */
.logo-container {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.logo-king {
  max-width: 200px;
  height: auto;
}

/* MOBILE */
@media (max-width: 768px) {
  #tabela th,
  #tabela td {
    width: 100% !important;
  }

  #tabela td input,
  #tabela td button {
    width: 100% !important;
    box-sizing: border-box;
  }

  #tabela td button {
    align-self: stretch;
  }

  #tabela td input[type="text"],
  #tabela td input[type="number"],
  #tabela td input[list] {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
  }

  #tabela td:nth-child(3) input,
  #tabela td:nth-child(4) input {
    text-align: right;
  }

  #tabela td button.remover {
    width: 100%;
  }

  .botoes {
    flex-direction: column;
  }

  .botoes button {
    width: 100%;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  #tabela tr {
    margin-bottom: 20px;
    border: 1px solid #ccc;
    padding: 10px;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
  }

  #tabela td {
    border: none;
    padding: 5px 0;
    display: flex;
    flex-direction: column;
    font-weight: normal;
    width: 100%;
    box-sizing: border-box;
  }

  #tabela td::before {
    content: attr(data-label);
    font-weight: bold;
    margin-bottom: 4px;
    color: white;
    background-color: #3a4f85;
    padding: 6px 10px;
    border-radius: 4px;
    text-align: center;
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  #tabela td select,
  #tabela td input,
  #tabela td button {
    max-width: 100%;
    box-sizing: border-box;
  }

  #tabela td button {
    align-self: flex-start;
    padding: 8px 16px;
    background-color: #c00;
    color: white;
    border: none;
    border-radius: 4px;
  }

  .observacao-total {
    flex-direction: column;
  }
}

/* === Correção visual TomSelect === */
.ts-wrapper.single .ts-control {
  min-height: 38px !important;
  height: 38px !important;
  line-height: 24px !important;
  overflow: hidden !important;
  padding: 6px 8px !important;
  display: flex !important;
  align-items: center !important;
}

.ts-control input {
  height: 24px !important;
  line-height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box !important;
}

/* === Correção extra para TomSelect dentro da tabela === */
#tabela td select.produto-select {
  display: none; /* Oculta o select original após TomSelect aplicado */
}

.ts-wrapper.single {
  width: 100% !important;
  box-sizing: border-box;
}

.ts-wrapper .ts-control {
  width: 100% !important;
  min-height: 38px !important;
  padding: 6px 8px !important;
  align-items: center;
  display: flex;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.ts-wrapper .ts-control .ts-single-item {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  flex-grow: 1;
}

.ts-dropdown {
  z-index: 10000 !important;
}

/* === NOVO: Asterisco vermelho nos campos obrigatórios === */
.required {
  color: red;
  margin-left: 4px;
}