:root {
  --fundo: #04070B; --texto: #EEF3FA; --suave: #A9B8CE; --borda: #2A3B57; --cartao: #0A111C;
  --laranja: #FF6A2B; --ambar: #FFC247; --verde: #6FC58F; --verde-vivo: #7EE0A0; --turquesa: #2FD0BD;
  --preto: #04070B; --raio: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0; color: var(--texto); background-color: var(--fundo);
  background-image:
    radial-gradient(420px 380px at -8% 18%, rgba(255, 106, 43, .16), transparent 70%),
    radial-gradient(420px 380px at 108% 62%, rgba(47, 208, 189, .14), transparent 70%);
  background-attachment: fixed;
  font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
.app { max-width: 480px; margin: 0 auto; padding: 8px 12px 6px; }
.topo { padding: 2px 2px 6px; }
.topo h1 {
  margin: 0; font-size: 22px; line-height: 1.15; letter-spacing: -.3px; display: inline-block;
  color: var(--ambar);
  background: linear-gradient(90deg, var(--laranja) 0%, var(--ambar) 38%, var(--verde-vivo) 62%, var(--verde-vivo) 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.topo .sub { margin: 0; font-size: 12px; color: var(--suave); }

/* seletor de tipo: pílula escura com indicador deslizante (4 abas) */
.tipos {
  --i: 0; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin: 4px 0 8px;
  height: 46px; background: #0B1220; border: 1px solid var(--borda); border-radius: 16px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6);
}
.tipos .ind {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 4); border-radius: 13px;
  background: linear-gradient(135deg, var(--laranja), var(--ambar));
  box-shadow: 0 0 14px rgba(255, 106, 43, .3), inset 0 1px 0 rgba(255, 255, 255, .4);
  transform: translateX(calc(var(--i) * 100%)); transition: transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.tipos button {
  position: relative; z-index: 1; border: 0; background: transparent; color: var(--texto); font: inherit; font-weight: 600;
  height: 44px; border-radius: 14px; cursor: pointer; padding: 0; transition: color .15s;
}
.tipos button[aria-pressed="true"] { color: #000; font-weight: 800; }
.tipos button:focus-visible { outline: 2px solid var(--turquesa); outline-offset: -3px; }

.cartoes { display: grid; gap: 6px; }
.cartao { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); padding: 4px 8px 4px; }
.cab { display: flex; align-items: center; gap: 4px; }
.cab .nome {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--texto);
  font: inherit; font-size: 13px; font-weight: 600; padding: 2px 2px; height: 24px; border-bottom: 1px dashed transparent;
}
.cab .nome::placeholder { color: var(--suave); opacity: 1; }
.cab .nome:focus { outline: 0; border-bottom-color: var(--ambar); }
.rem {
  width: 28px; height: 24px; border: 0; background: transparent; color: var(--suave);
  font-size: 18px; line-height: 1; border-radius: 6px; cursor: pointer; padding: 0;
}
.rem:disabled { opacity: .3; cursor: default; }

.campos { display: grid; grid-template-columns: 1fr 1fr 84px; gap: 6px; align-items: end; }
.col { min-width: 0; }
.col label { display: block; font-size: 11px; color: var(--suave); line-height: 13px; margin: 0 2px 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col input {
  width: 100%; min-width: 0; height: 44px; font: inherit; font-size: 17px; color: var(--texto);
  background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px; padding: 0 10px;
}
.col input::placeholder { color: #6f819c; }
.col input:focus { outline: 2px solid var(--ambar); outline-offset: -1px; }
.preco-box { position: relative; }
.preco-box span { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 14px; color: var(--suave); pointer-events: none; }
.preco-box input { padding-left: 32px; text-align: right; }
.col-un { height: 44px; }

/* chave de unidade: pílula escura com thumb deslizante em gradiente verde → turquesa */
.chave { display: block; position: relative; width: 84px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.trilho {
  position: absolute; left: 0; top: 2px; width: 84px; height: 40px; border-radius: 20px;
  background: #0B1220; border: 1px solid var(--borda); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .55);
  transition: transform .12s ease;
}
.chave:active .trilho { transform: scale(.97); }
.thumb {
  position: absolute; top: 2px; left: 2px; width: 39px; height: 34px; border-radius: 17px;
  background: linear-gradient(135deg, #7EE0A0, #2FD0BD);
  box-shadow: 0 0 12px rgba(126, 224, 160, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .22s cubic-bezier(.34, 1.56, .64, 1);
}
.chave[aria-checked="true"] .thumb { transform: translateX(39px); }
.op {
  position: absolute; top: 0; width: 41px; height: 38px; line-height: 38px; text-align: center;
  font-size: 14px; font-weight: 600; color: #A9B8CE; transition: color .15s;
}
.op-esq { left: 1px; } .op-dir { right: 1px; }
.op.on { color: #04070B; font-weight: 800; }
.chave:focus-visible { outline: none; }
.chave:focus-visible .trilho { outline: 2px solid var(--turquesa); outline-offset: 2px; }
.un-fixo {
  display: block; width: 84px; height: 40px; line-height: 38px; margin-bottom: 2px; text-align: center; font-weight: 700;
  background: #0B1220; border: 1px solid var(--borda); border-radius: 20px; color: #A9B8CE;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .55);
}

.linha3 { display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; min-height: 22px; padding: 1px 2px 0; }
.link-pacote { border: 0; background: transparent; color: var(--suave); font: inherit; font-size: 12px; text-decoration: underline; padding: 3px 0; cursor: pointer; }
.link-pacote:hover { color: var(--texto); }
.pac { font-size: 13px; color: var(--suave); display: inline-flex; align-items: center; gap: 4px; }
.pac[hidden] { display: none; }
.pac input { width: 64px; height: 44px; text-align: center; font: inherit; font-size: 17px; color: var(--texto); background: var(--fundo); border: 1px solid var(--borda); border-radius: 10px; }
.pac input::placeholder { color: #6f819c; }
.pac input:focus { outline: 2px solid var(--ambar); outline-offset: -1px; }
.fechar-pacote {
  width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--suave);
  font-size: 16px; cursor: pointer; padding: 0;
}
.fechar-pacote:hover { color: var(--texto); }
.nota { font-size: 12px; color: var(--suave); }
.nota:empty { display: none; }
.nota.erro { color: var(--ambar); }

.btn-add {
  width: 100%; min-height: 44px; margin-top: 6px; font: inherit; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--verde-vivo); border: 1.5px dashed var(--verde); border-radius: 12px;
}
.btn-add:disabled { opacity: .4; cursor: default; }

h2.titulo-res { font-size: 12px; text-transform: uppercase; letter-spacing: .7px; color: var(--suave); margin: 10px 2px 4px; }
.resultado { display: grid; gap: 6px; }
.res { background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); padding: 7px 10px; }
.res.melhor { border: 2px solid var(--verde); padding: 6px 9px; box-shadow: 0 0 16px rgba(111, 197, 143, .25); }
.res p { margin: 0; }
.l1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.id { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--borda); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.melhor .pos { background: var(--verde); color: #04070B; }
.idtxt { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.nome-res { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.total { font-size: 11px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preco-g { flex: none; text-align: right; white-space: nowrap; }
.preco-g .valor { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.preco-g .base { font-size: 13px; font-weight: 600; color: var(--suave); }
.l2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; min-height: 22px; }
.c100 { font-size: 12px; color: var(--suave); }
.pilula { margin-left: auto; font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 99px; color: #04070B; white-space: nowrap; }
.pilula.ok { background: #6FC58F; } .pilula.ok::before { content: "✓ "; }
.pilula.caro { background: #FFC247; } .pilula.caro::before { content: "▲ "; }
.pilula.neutra { background: #A9B8CE; } .pilula.neutra::before { content: "≈ "; }
.dif { font-size: 12px; color: var(--ambar); font-weight: 600; margin-top: 2px !important; }
.dica { margin: 0; padding: 6px 4px; font-size: 13px; color: var(--suave); text-align: center; }

.acoes { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
.acoes button { font: inherit; font-size: 13px; font-weight: 700; min-height: 44px; padding: 0 16px; border-radius: 10px; cursor: pointer; }
#btn-copiar { background: var(--turquesa); color: #04070B; border: 0; }
#btn-copiar.feito { background: var(--verde-vivo); }
#btn-copiar:disabled { opacity: .4; cursor: default; }
#btn-limpar { background: transparent; color: var(--texto); border: 1px solid var(--borda); }
.aviso { margin: 8px 4px 0; font-size: 12px; color: var(--suave); text-align: center; }

/* faixa fixa inferior */
.faixa {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); text-align: center; font-weight: 700; font-size: 15px;
  background: #0E1726; color: var(--texto); border-top: 1px solid var(--borda);
}
.faixa.melhor { background: #6FC58F; color: #04070B; border-top-color: #6FC58F; }

/* conteúdo abaixo do app */
.info { max-width: 480px; margin: 0 auto; padding: 4px 14px 0; }
.info h2 { font-size: 16px; margin: 18px 0 6px; }
.info p, .info li { font-size: 14px; color: var(--suave); margin: 4px 0; }
.info ol { padding-left: 20px; margin: 4px 0; }
.info strong { color: var(--texto); }
details { border: 1px solid var(--borda); border-radius: 10px; margin: 6px 0; background: var(--cartao); }
summary { cursor: pointer; padding: 11px 12px; font-size: 14px; font-weight: 600; min-height: 44px; }
details p { padding: 0 12px 10px; margin: 0; }
.rodape { max-width: 480px; margin: 16px auto 0; padding: 0 14px; text-align: center; font-size: 12px; color: var(--suave); }
.rodape a { color: var(--suave); }
.rodape .legais { margin-top: 4px; font-size: 11px; }
.rodape .legais a { margin: 0 4px; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--ambar); outline-offset: 2px; }

/* páginas legais */
.texto { max-width: 560px; margin: 0 auto; padding: 14px 14px 0; }
.texto h1 { font-size: 22px; margin: 10px 0; }
.texto h2 { font-size: 16px; margin: 18px 0 6px; }
.texto p, .texto li { color: var(--suave); font-size: 14px; }
.texto a { color: var(--verde-vivo); }
.voltar { display: inline-block; padding: 10px 0; min-height: 44px; }
body.legal { padding-bottom: 24px; }

@media (prefers-reduced-motion: reduce) {
  .thumb, .ind, .trilho, .op { transition: none !important; }
  .chave:active .trilho { transform: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
