:root {
  --vermelho: #d62828;
  --vermelho-esc: #a41f1f;
  --amarelo: #ffb703;
  --amarelo-esc: #b9820a;
  --creme: #fff7ec;
  --tinta: #2a2a2a;
  --cinza: #7a7a7a;
  --linha: #ecdfce;
  --card: #ffffff;
  --sombra: 0 1px 3px rgba(0,0,0,.08);
  --raio: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--creme);
  color: var(--tinta);
  line-height: 1.45;
}

/* Cabeçalho estilo folheto */
.topo { background: var(--vermelho); color: #fff; padding: 20px 16px 24px; border-bottom: 5px solid var(--amarelo); }
.topo-inner { max-width: 560px; margin: 0 auto; }
.topo h1 { margin: 0; font-size: 1.55rem; letter-spacing: -.01em; }
.topo .sub { margin: 4px 0 0; font-size: .9rem; color: #ffe3c2; }

main { max-width: 560px; margin: -12px auto 0; padding: 0 12px 40px; }
.bloco { background: var(--card); border-radius: var(--raio); box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px; }

.rotulo { display: block; font-size: 1rem; color: var(--vermelho-esc); margin-bottom: 8px; font-weight: 700; }

/* Busca com autocompletar */
.busca-wrap { position: relative; }
#busca {
  width: 100%; padding: 13px 14px; font-size: 1rem;
  border: 2px solid var(--linha); border-radius: 10px; outline: none; transition: border-color .15s;
}
#busca:focus { border-color: var(--amarelo); }
.sugestoes {
  list-style: none; margin: 4px 0 0; padding: 4px; position: absolute; z-index: 20;
  left: 0; right: 0; background: #fff; border: 2px solid var(--linha); border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12); max-height: 280px; overflow-y: auto;
}
.sugestoes li {
  padding: 10px 10px; border-radius: 8px; cursor: pointer; font-size: .92rem;
  display: flex; align-items: center; gap: 8px;
}
.sugestoes li:hover, .sugestoes li.ativa { background: var(--creme); }
.sug-add { font-weight: 700; color: var(--vermelho); }
.sug-preco { margin-left: auto; font-size: .8rem; color: var(--cinza); white-space: nowrap; }
.sug-marca { font-size: .78rem; color: var(--cinza); }

/* Chips da lista */
.chips { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  display: inline-flex; align-items: center; gap: 6px; background: var(--creme);
  border: 1.5px solid var(--linha); border-radius: 999px; padding: 6px 8px 6px 12px; font-size: .9rem;
}
.chips .x { border: 0; background: var(--vermelho); color: #fff; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: .85rem; line-height: 1; display: flex; align-items: center; justify-content: center; }
.chips .x:active { transform: scale(.9); }

.vazio { color: var(--cinza); font-size: .9rem; text-align: center; padding: 14px 0 4px; }

.btn-principal {
  width: 100%; margin-top: 14px; padding: 15px; background: var(--amarelo); color: #6a3d00;
  border: 0; border-radius: 10px; font-size: 1.08rem; font-weight: 700; cursor: pointer; transition: background .15s;
}
.btn-principal:hover:not(:disabled) { background: var(--amarelo-esc); color: #fff; }
.btn-principal:disabled { background: #eadfce; color: #b3a58c; cursor: not-allowed; }

/* Resultado */
.resultado h2 { margin-top: 0; color: var(--vermelho-esc); }
.destaque { background: #fff4d6; border: 2px dashed var(--amarelo); border-radius: 12px; padding: 14px; margin-bottom: 14px; text-align: center; }
.destaque .grande { font-size: 1.7rem; font-weight: 800; color: var(--vermelho); display: block; }
.destaque small { color: #9a6a00; }

.item-res { padding: 12px 0; border-bottom: 1px solid var(--linha); }
.item-res:last-child { border-bottom: 0; }
.termo { font-weight: 700; font-size: .98rem; text-transform: capitalize; margin-bottom: 8px; }
.opcoes { display: flex; gap: 10px; }
.opcao { flex: 1; border: 2px solid var(--linha); border-radius: 10px; padding: 10px; }
.opcao.vence { border-color: var(--vermelho); background: #fff0f0; }
.op-topo { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.op-mercado { font-size: .82rem; color: var(--cinza); font-weight: 700; }
.selo-barato { font-size: .68rem; font-weight: 700; color: #fff; background: var(--vermelho); padding: 2px 8px; border-radius: 999px; }
.op-preco { font-size: 1.15rem; font-weight: 800; color: var(--vermelho); }
.op-unit { font-size: .72rem; color: var(--cinza); font-weight: 500; }
.op-nome { font-size: .76rem; color: var(--tinta); margin-top: 3px; line-height: 1.3; }
.item-res.nao-achou .sem { font-size: .84rem; color: var(--amarelo-esc); }

.rodape { text-align: center; font-size: .75rem; color: var(--cinza); padding: 8px 16px 30px; line-height: 1.5; }
.girando { animation: girar .8s linear infinite; display: inline-block; }
@keyframes girar { to { transform: rotate(360deg); } }
