* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f4f6f8;
  color: #222;
}

.container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 1100px;
  background: #fff;
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}

.topo {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

h1 {
  margin-top: 0;
  margin-bottom: 8px;
}

p {
  color: #5b6472;
}

.contador {
  padding: 10px 14px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 700;
  white-space: nowrap;
}

form {
  display: flex;
  gap: 10px;
  margin: 22px 0;
}

input {
  flex: 1;
  padding: 15px;
  border: 1px solid #cfd4dc;
  border-radius: 14px;
  font-size: 17px;
}

input:focus {
  outline: none;
  border-color: #111827;
  box-shadow: 0 0 0 4px rgba(17, 24, 39, .10);
}

button {
  padding: 14px 20px;
  border: 0;
  border-radius: 14px;
  background: #111827;
  color: white;
  font-size: 16px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: #000;
}

button:disabled {
  opacity: .6;
  cursor: not-allowed;
}

#status {
  margin: 12px 0;
  font-weight: bold;
}

.erro {
  color: #b00020;
}

.sucesso {
  color: #0f766e;
}

.resultado {
  margin-top: 18px;
}

.resultado-consulta,
.dados-completos {
  margin-top: 24px;
  padding: 24px;
  border-radius: 22px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.resultado-cabecalho {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e5e7eb;
}

.resultado-tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.resultado-cabecalho h2 {
  margin: 0;
  font-size: 25px;
  line-height: 1.2;
  color: #111827;
}

.resultado-cabecalho p {
  margin: 6px 0 0;
  color: #6b7280;
  font-weight: 700;
}

.resultado-status {
  min-width: 130px;
  text-align: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  background: #f3f4f6;
  color: #374151;
}

.resultado-status.ativo {
  background: #dcfce7;
  color: #166534;
}

.resultado-status.inativo {
  background: #fee2e2;
  color: #991b1b;
}

.resultado-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.campo-resultado {
  position: relative;
  min-height: 74px;
  padding: 20px 14px 13px;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  background: #f9fafb;
}

.campo-resultado label {
  position: absolute;
  top: -8px;
  left: 12px;
  padding: 0 6px;
  background: #f9fafb;
  color: #6b7280;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.campo-resultado div {
  color: #111827;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
}

.campo-grande {
  grid-column: span 2;
}

.dados-completos h2 {
  margin: 0 0 4px;
}

.subtexto {
  margin-top: 0;
  margin-bottom: 18px;
}

.abas,
.subabas {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  margin-bottom: 18px;
  padding: 6px;
  background: #f3f4f6;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
}

.aba,
.subaba {
  flex: 1;
  background: transparent;
  color: #4b5563;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
}

.aba:hover,
.subaba:hover {
  background: #e5e7eb;
  color: #111827;
}

.aba.ativa,
.subaba.ativa {
  background: #111827;
  color: #fff;
}

.conteudo-aba,
.conteudo-subaba {
  display: none;
}

.conteudo-aba.ativo,
.conteudo-subaba.ativo {
  display: block;
}

.subabas {
  flex-wrap: wrap;
  margin-top: 18px;
}

.subaba {
  min-width: 110px;
  font-size: 13px;
  padding: 11px 12px;
}

.subabas-conteudo {
  margin-top: 14px;
}

.historico {
  margin-top: 28px;
}

.historico h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.item-historico {
  width: 100%;
  display: block;
  text-align: left;
  background: #f9fafb;
  color: #111827;
  border: 1px solid #e5e7eb;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
}

.item-historico:hover {
  background: #eef2ff;
}

.item-historico strong,
.item-historico span,
.item-historico small {
  display: block;
}

.item-historico small {
  color: #6b7280;
  margin-top: 4px;
}

.limpar-historico {
  margin-top: 8px;
  background: #6b7280;
}

.limpar-historico:hover {
  background: #4b5563;
}

@media (max-width: 980px) {
  .resultado-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .campo-grande {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .topo {
    flex-direction: column;
  }

  .contador {
    white-space: normal;
  }
}

@media (max-width: 620px) {
  .card {
    padding: 20px;
  }

  form,
  .abas {
    flex-direction: column;
  }

  button,
  .aba,
  .subaba {
    width: 100%;
  }

  .resultado-consulta,
  .dados-completos {
    padding: 18px;
  }

  .resultado-cabecalho {
    flex-direction: column;
  }

  .resultado-status {
    width: 100%;
  }

  .resultado-grid {
    grid-template-columns: 1fr;
  }

  .campo-grande {
    grid-column: span 1;
  }
}