/* Super M — cores do logo */
:root {
  --verde: #0b4d3b;
  --verde-2: #136b52;
  --folha: #5bbf8a;
  --menta: #72cfa3;
  --menta-clara: #e4f5ec;
  --amarelo: #febc27;
  --amarelo-claro: #fff4d6;
  --fundo: #f4f7f3;
  --cartao: #ffffff;
  --texto: #15302a;
  --suave: #667a72;
  --linha: #e2eae5;
  --erro: #c2453d;
  --sombra: 0 2px 10px rgba(11, 77, 59, .07);
  --raio: 16px;
  --nav: 68px;
  --fonte-titulo: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.hide { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--verde-2); }
h1, h2, h3 { font-family: var(--fonte-titulo); color: var(--verde); margin: 0; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 19px; font-weight: 800; margin: 26px 0 10px; }
h3 { font-size: 16px; font-weight: 700; }
small, .suave { color: var(--suave); }

/* ---------- topo e navegação ---------- */
#topo {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(244, 247, 243, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
#topo strong { font-family: var(--fonte-titulo); font-size: 20px; font-weight: 800; color: var(--verde); }
.espaco { flex: 1; }
.botao-icone {
  border: 0; background: none; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--verde);
}
.botao-icone:active { background: var(--menta-clara); }
.botao-icone.claro { color: #fff; background: rgba(0, 0, 0, .35); }

main { max-width: 640px; margin: 0 auto; padding: 4px 16px calc(var(--nav) + 32px + env(safe-area-inset-bottom)); }

#abas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around; align-items: flex-end;
  height: calc(var(--nav) + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
  background: #fff; border-top: 1px solid var(--linha);
}
#abas button {
  flex: 1; max-width: 110px; border: 0; background: none; color: var(--suave);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; padding: 10px 0 12px;
}
#abas button.ativo { color: var(--verde); }
#abas button.ativo svg { stroke-width: 2.4; }
#abas .ler { color: var(--verde); }
#abas .ler span {
  display: grid; place-items: center; width: 58px; height: 58px; margin-top: -26px; border-radius: 50%;
  background: var(--verde); color: #fff; box-shadow: 0 6px 16px rgba(11, 77, 59, .35); border: 4px solid #fff;
}
#abas .ler span svg { width: 28px; height: 28px; stroke-width: 2.4; }

/* ---------- blocos ---------- */
.cartao {
  background: var(--cartao); border: 1px solid var(--linha); border-radius: var(--raio);
  padding: 16px; margin: 12px 0; box-shadow: var(--sombra);
}
.cartao.destaque { background: var(--verde); color: #fff; border: 0; }
.cartao.destaque h1, .cartao.destaque h3 { color: #fff; }
.cartao.destaque small { color: rgba(255, 255, 255, .75); }
.titulo-aba { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 4px; }
.vazio { text-align: center; color: var(--suave); padding: 28px 18px; }
.vazio .grande { font-size: 42px; display: block; margin-bottom: 6px; }

.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 18px; min-height: 46px;
  background: var(--verde); color: #fff; font-weight: 700; text-decoration: none;
}
.botao:active { background: var(--verde-2); }
.botao[disabled] { opacity: .55; }
.botao.secundario { background: var(--menta-clara); color: var(--verde); }
.botao.amarelo { background: var(--amarelo); color: var(--verde); }
.botao.perigo { background: #fbe9e7; color: var(--erro); }
.botao.claro { background: rgba(255, 255, 255, .92); color: var(--verde); }
.botao.cheio { width: 100%; }
.botoes { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.botoes > * { flex: 1 1 140px; }
.link { border: 0; background: none; color: var(--verde-2); padding: 8px 0; font-weight: 600; text-decoration: underline; }

label { display: block; font-size: 14px; font-weight: 600; color: var(--suave); margin: 10px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], select {
  display: block; width: 100%; margin-top: 5px; padding: 12px; min-height: 46px;
  border: 1px solid #d4e0d9; border-radius: 12px; background: #fff; font-size: 16px; font-weight: 400; color: var(--texto);
}
input:focus, select:focus { outline: 2px solid var(--menta); outline-offset: 0; border-color: var(--folha); }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--texto); }
label.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--verde); flex: none; }
.erro { color: var(--erro); min-height: 1.2em; margin: 10px 0 4px; font-size: 14px; }
.dica { color: var(--suave); font-size: 14px; margin: 0 0 4px; }

/* ---------- entrar ---------- */
#tela-entrar { min-height: 100vh; display: flex; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 16px 40px; }
.entrar-caixa { width: 100%; max-width: 400px; }
.logo-grande { display: block; width: 230px; height: auto; margin: 8px auto 0; }
.slogan { text-align: center; color: var(--suave); margin: 4px 0 18px; }
.seletor { display: flex; background: #e6eee9; border-radius: 12px; padding: 4px; }
.seletor button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--suave); }
.seletor button.ativo { background: #fff; color: var(--verde); box-shadow: var(--sombra); }
.entrar-caixa .botao { width: 100%; margin-top: 4px; }
.entrar-caixa .link { display: block; margin: 8px auto 0; }

/* ---------- lista ---------- */
.adicionar { display: flex; gap: 8px; align-items: stretch; }
.adicionar input { margin: 0; }
.adicionar .qtd { flex: 0 0 74px; }
.adicionar .botao { flex: 0 0 52px; padding: 0; font-size: 26px; }
.resumo-lista { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.resumo-lista strong { font-family: var(--fonte-titulo); font-size: 24px; }

.grupo { margin-top: 14px; }
.grupo-titulo { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--verde); font-size: 15px; margin: 0 2px 6px; }
.grupo-titulo .emoji { font-size: 18px; }
.linhas { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio); overflow: hidden; box-shadow: var(--sombra); }
.linha { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-top: 1px solid var(--linha); min-height: 58px; }
.linha:first-child { border-top: 0; }
.linha .corpo { flex: 1; min-width: 0; }
.linha .nome { font-weight: 600; overflow-wrap: anywhere; }
.linha .info { font-size: 13px; color: var(--suave); margin-top: 1px; }
.linha .info b { color: var(--verde-2); }
.linha .valor { font-weight: 700; white-space: nowrap; text-align: right; }
.linha .valor small { display: block; font-weight: 400; font-size: 12px; }
.linha.toque { cursor: pointer; }
.linha.toque:active { background: #f6faf7; }
.linha.feito .nome { text-decoration: line-through; color: var(--suave); }
.marcar {
  flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #b7cbbf; background: #fff;
  display: grid; place-items: center; padding: 0;
}
.marcar svg { width: 16px; height: 16px; stroke: #fff; stroke-width: 3; opacity: 0; }
.marcar.ok { background: var(--folha); border-color: var(--folha); }
.marcar.ok svg { opacity: 1; }
.tirar { flex: none; border: 0; background: none; color: #a7b5ae; font-size: 22px; width: 34px; height: 34px; border-radius: 10px; }
.tirar:active { background: #fbe9e7; color: var(--erro); }
.seta { color: #b4c3bb; flex: none; }
.selo { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 2px 8px; background: var(--amarelo-claro); color: #8a5d00; vertical-align: 1px; }
.selo.verde { background: var(--menta-clara); color: var(--verde); }
details.comprados > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--suave); padding: 6px 2px; }
details.comprados > summary::-webkit-details-marker { display: none; }
details.comprados > summary::after { content: "▾"; transition: transform .2s; }
details.comprados[open] > summary::after { transform: rotate(180deg); }

/* ---------- compras ---------- */
.mes-titulo { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 2px 8px; }
.mes-titulo span { font-weight: 700; color: var(--verde); }
.icone-mercado {
  flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--menta-clara); color: var(--verde);
  display: grid; place-items: center; font-weight: 800; font-family: var(--fonte-titulo);
}
.gastos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gastos div small { display: block; }
.gastos strong { font-family: var(--fonte-titulo); font-size: 22px; }

/* ---------- produtos ---------- */
.busca { position: relative; }
.busca svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--suave); width: 20px; height: 20px; }
.busca input { padding-left: 40px; margin: 0; }
.filtros { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.filtros::-webkit-scrollbar { display: none; }
.filtros button { flex: none; border: 1px solid var(--linha); background: #fff; border-radius: 20px; padding: 6px 12px; font-size: 14px; font-weight: 600; color: var(--suave); }
.filtros button.ativo { background: var(--verde); border-color: var(--verde); color: #fff; }
.emoji-cat { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--fundo); display: grid; place-items: center; font-size: 20px; }

.tabela-precos .linha { min-height: 52px; }
.tabela-precos .melhor { background: #f2fbf6; }

/* ---------- folha ---------- */
#folha { position: fixed; inset: 0; z-index: 30; }
.folha-fundo { position: absolute; inset: 0; background: rgba(10, 30, 24, .45); animation: aparece .2s; }
.folha-painel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - 40px - env(safe-area-inset-top)); overflow-y: auto;
  background: var(--fundo); border-radius: 22px 22px 0 0; padding: 22px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sobe .25s ease-out; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
@media (min-width: 700px) {
  .folha-painel { left: 50%; right: auto; width: 620px; transform: translateX(-50%); bottom: auto; top: 6vh; border-radius: 22px; max-height: 88vh; animation: aparece .2s; }
}
.folha-x { position: absolute; top: 12px; right: 10px; }
#folha-conteudo > h1 { padding-right: 44px; font-size: 22px; }
.folha-sub { color: var(--suave); margin: 4px 0 8px; }
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
@keyframes aparece { from { opacity: 0; } }

.carregando { text-align: center; padding: 30px 10px; }
.giro { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--menta-clara); border-top-color: var(--verde); margin: 0 auto 14px; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.grande-ok { width: 64px; height: 64px; border-radius: 50%; background: var(--folha); color: #fff; display: grid; place-items: center; margin: 4px auto 10px; }
.grande-ok svg { width: 34px; height: 34px; stroke-width: 3; }
.centro { text-align: center; }

.item-manual { display: grid; grid-template-columns: 1fr 64px 88px 34px; gap: 6px; align-items: center; margin-top: 8px; }
.item-manual input { margin: 0; padding: 10px 8px; }
.cabeca-itens { display: grid; grid-template-columns: 1fr 64px 88px 34px; gap: 6px; font-size: 12px; color: var(--suave); margin-top: 14px; }

/* ---------- leitor ---------- */
#leitor { position: fixed; inset: 0; z-index: 40; background: #000; }
#leitor video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mira { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.mira span {
  width: min(68vw, 300px); aspect-ratio: 1; border-radius: 24px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); border: 3px solid var(--amarelo);
}
.leitor-topo { position: absolute; top: calc(12px + env(safe-area-inset-top)); left: 12px; }
.leitor-baixo { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(22px + env(safe-area-inset-bottom)); text-align: center; color: #fff; }
#leitor-msg { margin: 0 0 14px; font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.leitor-botoes { display: flex; gap: 10px; justify-content: center; }
.leitor-botoes .botao { flex: 1; max-width: 170px; margin: 0; font-size: 16px; }
#form-link { display: flex; gap: 8px; margin-top: 12px; }
#form-link input { margin: 0; }

/* ---------- aviso ---------- */
#aviso {
  position: fixed; left: 50%; bottom: calc(var(--nav) + 18px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px);
  background: var(--verde); color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 15px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
#aviso.mostra { opacity: 1; transform: translate(-50%, 0); }
#aviso.ruim { background: var(--erro); }
