:root {
  --red: #8b1a1a;
  --red-bright: #a82222;
  --whats: #1f7a3d;
  --whats-bright: #26993f;
  --charcoal: #1a1a1a;
  --texto: #1a1a1a;
  --suave: #5c5c5c;
  --fundo: #f2f2f2;
  --cartao: #ffffff;
  --linha: #d6d6d6;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 18px; line-height: 1.35;
  color: var(--texto); background: var(--fundo);
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

.topo {
  position: sticky; top: 0; z-index: 10; background: #fff;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 0;
  border-bottom: 4px solid var(--red); box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.topo-logo { display: block; height: 84px; margin: 0 auto 2px; }
.abas { display: flex; }
.aba {
  flex: 1; background: none; border: 0; color: #8a8a8a; padding: 12px 4px;
  font-weight: 700; font-size: 17px; border-bottom: 4px solid transparent;
}
.aba.ativa { color: var(--red); border-bottom-color: var(--red); }

main { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
.tela { display: none; }
.tela.ativa { display: block; }
.titulo { margin: 8px 0 12px; font-size: 22px; }

.numero-linha { display: flex; justify-content: space-between; align-items: center; margin: 4px 2px 10px; color: var(--suave); }
.numero-linha strong { color: var(--texto); font-size: 20px; }
.link { background: none; border: 0; color: var(--red); font-weight: 700; padding: 8px 0; text-decoration: underline; }

.bloco { background: var(--cartao); border-radius: 14px; padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.bloco h2 { margin: 0 0 12px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.passo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 16px; flex: none;
}

label { display: block; font-weight: 600; margin-bottom: 12px; }
label small { display: block; font-weight: 400; color: var(--suave); font-size: 15px; margin-top: 4px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 14px 12px; min-height: 52px;
  border: 2px solid var(--linha); border-radius: 10px; background: #fff; color: var(--texto); font-size: 18px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); }
textarea { min-height: 80px; resize: vertical; }

.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.opcoes.pequenas { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.opcoes button {
  background: #fff; border: 2px solid var(--linha); border-radius: 12px; padding: 14px 10px;
  font-weight: 700; color: var(--texto); min-height: 56px;
}
.opcoes button small { display: block; font-weight: 400; font-size: 14px; color: var(--suave); margin-top: 2px; }
.opcoes button.sel { border-color: var(--red); background: var(--red); color: #fff; }
.opcoes button.sel small { color: #f3d6d6; }

.sugestoes { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 12px; }
.sugestoes button {
  background: #f4eaea; color: var(--red); border: 0; border-radius: 999px; padding: 10px 14px; font-size: 15px; font-weight: 700;
}
.mais summary { color: var(--red); font-weight: 700; padding: 8px 0; margin-bottom: 8px; }

.item { border: 2px solid var(--linha); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.item-topo { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-weight: 700; }
.item-remover { background: none; border: 0; color: var(--red); font-weight: 700; padding: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.chip {
  background: #f4eaea; color: var(--red); border: 0; border-radius: 999px; padding: 10px 14px;
  font-size: 15px; font-weight: 600;
}
.chip.sel { background: var(--red); color: #fff; }

.total { display: flex; justify-content: space-between; align-items: baseline; font-size: 20px; margin-top: 8px; padding-top: 12px; border-top: 2px solid var(--linha); }
.total strong { font-size: 26px; }
.info { color: var(--suave); font-size: 15px; margin: 4px 0 0; }
.centro { text-align: center; }

.primario, .secundario, .whats {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 16px; font-weight: 800; font-size: 18px; min-height: 56px;
}
.primario { background: var(--red); color: #fff; }
.secundario { background: #fff; color: var(--red); border: 2px solid var(--red); }
.whats { background: var(--whats); color: #fff; }
.primario:active { background: var(--red-bright); }
.whats:active { background: var(--whats-bright); }

.acoes {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: block;
  padding: 10px 16px calc(env(safe-area-inset-bottom) + 10px); background: rgba(255,255,255,.96);
  border-top: 1px solid var(--linha); box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.acoes[hidden] { display: none; }
.espaco-rodape { height: 96px; }

.hist {
  background: var(--cartao); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.hist-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; font-weight: 700; }
.hist-topo > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.hist-sub { color: var(--suave); font-size: 15px; margin: 4px 0 10px; }
.hist-botoes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hist-botoes button { padding: 12px; min-height: 48px; font-size: 16px; }
.etiqueta { flex: none; font-size: 14px; line-height: 1.2; padding: 5px 10px; border-radius: 999px; white-space: nowrap; background: #fbeee0; color: #a3560b; }
.etiqueta.feito { background: #e3f1e7; color: var(--whats); }
.filtros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.filtros button { background: #fff; border: 2px solid var(--linha); border-radius: 999px; padding: 10px 6px; font-weight: 700; font-size: 16px; color: var(--texto); }
.filtros button.sel { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.fundo-escuro { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; }
.fundo-escuro[hidden] { display: none; }
.painel {
  width: 100%; max-width: 640px; margin: 0 auto; background: #fff; border-radius: 20px 20px 0 0;
  padding: 22px 16px calc(env(safe-area-inset-bottom) + 16px); display: grid; gap: 10px;
}
.painel h2 { margin: 0; font-size: 22px; }
.painel-ok { margin: 0; color: var(--whats); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .04em; }
.painel-dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.painel-fechar { justify-self: center; }
#tela-codigo { align-items: center; background: var(--fundo); }
#tela-codigo .painel { border-radius: 20px; margin: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.1); }
#codigo { font-size: 28px; text-align: center; letter-spacing: .3em; }
.primario:disabled { opacity: .6; }
.vazio { text-align: center; color: var(--suave); padding: 40px 10px; }

.aviso {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 92px); z-index: 20;
  background: var(--charcoal); color: #fff; padding: 14px 16px; border-radius: 12px; text-align: center;
  opacity: 0; transform: translateY(10px); transition: .25s; pointer-events: none;
}
.aviso.mostra { opacity: 1; transform: none; }
