/* Junior Águas e Gás — identidade visual do sistema.
   Azul profundo, cartões arredondados, navegação inferior no celular. */

:root {
  --azul: #2f3aa0;
  --azul-escuro: #232b7c;
  --azul-claro: #eef0fb;
  --fundo: #fbfbfe;
  --carta: #ffffff;
  --tinta: #14151f;
  --tinta-fraca: #656a80;
  --linha: #e5e6ee;
  --verde: #0d8a5f;
  --verde-fundo: #e6f6ef;
  --ambar: #b26a00;
  --ambar-fundo: #fdf1de;
  --vermelho: #c62a2a;
  --vermelho-fundo: #fdeaea;
  --laranja: #c25a08;
  --laranja-fundo: #fdefe2;
  --raio: 18px;
  --raio-g: 26px;
  --sombra: 0 1px 2px rgba(20, 21, 31, .05), 0 8px 24px -18px rgba(20, 21, 31, .35);
  --lateral: 260px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--fundo);
  color: var(--tinta);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px;
}

a { color: inherit; text-decoration: none; }

h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -.03em; margin: 0; }
h2 { font-size: 1.15rem; font-weight: 750; letter-spacing: -.02em; margin: 0 0 12px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 8px; }
p  { margin: 0 0 8px; }

.subtitulo { color: var(--tinta-fraca); font-size: .85rem; margin: 2px 0 0; }
.sr-oculto { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.fraco { color: var(--tinta-fraca); }
.pequeno { font-size: .8rem; }
.forte { font-weight: 700; }
.direita { text-align: right; }
.centro { text-align: center; }

svg { width: 20px; height: 20px; display: block; }

/* ---------- Estrutura ---------- */

.conteudo {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px;
}

.lateral { display: none; }

.topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
  max-width: 1120px;
  margin: 0 auto;
}

.topo-marca { height: 56px; width: auto; object-fit: contain; }
.topo-acoes { display: flex; gap: 8px; }

.botao-icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--azul-claro);
  color: var(--azul);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}

.cabecalho-pagina {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.cabecalho-pagina h1 { line-height: 1.15; }

.linha-titulo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

/* ---------- Navegação inferior (celular) ---------- */

.barra-inferior {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px calc(env(safe-area-inset-bottom, 0px) / 2);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--linha);
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -6px 28px -20px rgba(20, 21, 31, .5);
}

.barra-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
  color: var(--tinta-fraca);
  font-size: .68rem;
  font-weight: 600;
}

.barra-item.ativo { color: var(--azul); }
.barra-item.ativo svg { transform: scale(1.08); }

.barra-central {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  margin-top: -34px;
  border-radius: 20px;
  background: var(--azul);
  color: #fff;
  border: 4px solid var(--fundo);
  box-shadow: 0 12px 24px -10px rgba(47, 58, 160, .7);
}

.barra-central svg { width: 26px; height: 26px; }

/* ---------- Cartões ---------- */

.carta {
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 16px;
  box-shadow: var(--sombra);
}

.carta + .carta { margin-top: 12px; }

.carta-larga { border-radius: var(--raio-g); padding: 20px; }

.grade { display: grid; gap: 12px; }
.grade-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.pilha { display: flex; flex-direction: column; gap: 12px; }
.secao { margin-bottom: 26px; }

/* ---------- Listas ---------- */

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  padding: 14px 16px;
  box-shadow: var(--sombra);
}

.item + .item { margin-top: 10px; }
.item-corpo { min-width: 0; flex: 1; }
.item-titulo { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-linha { font-size: .8rem; color: var(--tinta-fraca); }
.item-acoes { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.item-alerta { border-left: 5px solid var(--vermelho); }

.vazio {
  padding: 28px 16px;
  text-align: center;
  color: var(--tinta-fraca);
  background: var(--carta);
  border: 1px dashed var(--linha);
  border-radius: var(--raio);
}

/* ---------- Tarjas ---------- */

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag-verde    { background: var(--verde-fundo); color: var(--verde); border-color: #bfe6d5; }
.tag-ambar    { background: var(--ambar-fundo); color: var(--ambar); border-color: #f2ddba; }
.tag-vermelha { background: var(--vermelho-fundo); color: var(--vermelho); border-color: #f4c9c9; }
.tag-laranja  { background: var(--laranja-fundo); color: var(--laranja); border-color: #f5d3b6; }
.tag-azul     { background: var(--azul-claro); color: var(--azul); border-color: #d3d8f5; }
.tag-cinza    { background: #f1f2f6; color: var(--tinta-fraca); border-color: var(--linha); }

/* ---------- Formulários ---------- */

.campo { margin-bottom: 14px; }
.campo label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--tinta);
}
.campo .dica { font-weight: 500; color: var(--tinta-fraca); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], input[type=search], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--linha);
  border-radius: 14px;
  background: var(--carta);
  font: inherit;
  color: inherit;
  appearance: none;
}

textarea { min-height: 84px; resize: vertical; }

input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 2px;
}

.campo-busca { position: relative; margin-bottom: 14px; }
.campo-busca svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--tinta-fraca); }
.campo-busca input { padding-left: 42px; }

.dupla { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Botões ---------- */

.botao {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 15px;
  border: 1px solid transparent;
  background: var(--azul);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}

.botao:active { transform: scale(.98); }
.botao[disabled] { opacity: .5; cursor: not-allowed; }
.botao-largo { width: 100%; }
.botao-alto { padding: 15px 20px; font-size: 1.02rem; }

/* Fundo sólido, não transparente: estes botões ficam em barras fixas sobre
   o conteúdo que rola, e transparência deixava o texto passar por trás. */
.botao-vazado { background: var(--carta); color: var(--azul); border-color: var(--linha); }
.botao-vazado:hover { background: var(--fundo); border-color: #c8cce4; }
.botao-suave { background: var(--azul-claro); color: var(--azul); }
.botao-perigo { background: var(--vermelho); }
.botao-perigo-vazado { background: transparent; color: var(--vermelho); border-color: #f4c9c9; }
.botao-pequeno { padding: 8px 12px; font-size: .8rem; border-radius: 12px; }

.acoes-rodape { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }

/* Chips de filtro */
.filtros { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--linha);
  background: var(--carta);
  font-size: .8rem;
  font-weight: 650;
  white-space: nowrap;
  color: var(--tinta-fraca);
  cursor: pointer;
}
.chip.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }

/* Opções em botão (entrega / pagamento) */
.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opcao {
  padding: 13px;
  border-radius: 15px;
  border: 1px solid var(--linha);
  background: var(--carta);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.opcao.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }

/* ---------- Avisos ---------- */

.aviso {
  padding: 13px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: .9rem;
  border: 1px solid transparent;
}
.aviso-ok   { background: var(--verde-fundo); color: var(--verde); border-color: #bfe6d5; }
.aviso-erro { background: var(--vermelho-fundo); color: var(--vermelho); border-color: #f4c9c9; }
.aviso-info { background: var(--azul-claro); color: var(--azul); border-color: #d3d8f5; }

/* ---------- Tabela simples ---------- */

.tabela { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tabela th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  color: var(--tinta-fraca);
  padding: 8px 10px;
  border-bottom: 1px solid var(--linha);
}
.tabela td { padding: 11px 10px; border-bottom: 1px solid var(--linha); }
.tabela tr:last-child td { border-bottom: none; }
.rolagem { overflow-x: auto; }

/* ---------- Login ---------- */

body.login { padding-bottom: 0; background: var(--carta); }

.tela-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

/* Usado pelo instalador */
.caixa-login {
  width: 100%;
  max-width: 400px;
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: var(--raio-g);
  padding: 28px 24px;
}

.caixa-login img { display: block; height: 92px; margin: 0 auto 18px; object-fit: contain; }

/* Tela de entrada */
.acesso { width: 100%; max-width: 344px; }

.acesso-marca {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  height: 150px;
  margin-bottom: 40px;
}

.acesso-marca img {
  position: relative;
  z-index: 2;
  height: 128px;
  width: auto;
  object-fit: contain;
  transform-origin: 50% 90%;
  animation: surgir 900ms cubic-bezier(.2, .7, .3, 1) both,
             respirar 6s ease-in-out 900ms infinite;
}

/* Ondas que saem de baixo do logo — referência à água */
.acesso-onda {
  position: absolute;
  bottom: 4px;
  left: 50%;
  width: 132px;
  height: 132px;
  margin-left: -66px;
  border-radius: 50%;
  border: 1px solid var(--azul);
  opacity: 0;
  z-index: 1;
  animation: ondular 5s cubic-bezier(.25, .6, .3, 1) infinite;
}

.acesso-onda:nth-child(2) { animation-delay: 1.6s; }
.acesso-onda:nth-child(3) { animation-delay: 3.2s; }

@keyframes surgir {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes respirar {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-7px) scale(1.012); }
}

@keyframes ondular {
  0%   { opacity: 0; transform: scale(.55); }
  12%  { opacity: .32; }
  100% { opacity: 0; transform: scale(1.7); }
}

.acesso-titulo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.035em;
  text-align: center;
  margin: 0 0 4px;
}

.acesso-linha {
  text-align: center;
  font-size: .82rem;
  color: var(--tinta-fraca);
  margin: 0 0 28px;
}

.acesso form { animation: surgir 900ms cubic-bezier(.2, .7, .3, 1) 260ms both; }

.acesso .campo { margin-bottom: 12px; }

.acesso input {
  height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--fundo);
  border: 1px solid var(--linha);
  font-size: .95rem;
  transition: border-color 160ms ease, background 160ms ease;
}

.acesso input::placeholder { color: var(--tinta-fraca); }
.acesso input:hover { border-color: #d5d7e4; }
.acesso input:focus { background: var(--carta); border-color: var(--azul); outline: none; box-shadow: 0 0 0 3px rgba(47, 58, 160, .12); }

.acesso .botao { height: 52px; border-radius: 16px; margin-top: 6px; font-size: .98rem; }

.acesso-rodape {
  text-align: center;
  font-size: .76rem;
  color: var(--tinta-fraca);
  margin: 26px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .acesso-marca img, .acesso form { animation: none; opacity: 1; transform: none; }
  .acesso-onda { display: none; }
}

/* ---------- Venda ---------- */

.progresso {
  height: 5px;
  background: #eceef5;
  border-radius: 99px;
  overflow: hidden;
  margin: 4px 0 22px;
}

.progresso i {
  display: block;
  height: 100%;
  width: 33%;
  background: var(--azul);
  border-radius: 99px;
  transition: width 420ms cubic-bezier(.2, .7, .3, 1);
}

.etapa { animation: entrar 380ms cubic-bezier(.2, .7, .3, 1) both; }

/* Opções em botão */
.opcoes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.opcao {
  position: relative;
  padding: 15px 34px 15px 15px;
  border-radius: 15px;
  border: 1px solid var(--linha);
  background: var(--fundo);
  font: inherit;
  font-weight: 700;
  font-size: .92rem;
  color: var(--tinta);
  cursor: pointer;
  text-align: center;
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1),
              border-color 180ms ease, background 180ms ease, box-shadow 200ms ease;
}

.opcao:hover { transform: translateY(-2px); border-color: #c8cce4; background: var(--carta); }
.opcao:active { transform: translateY(0); }

.opcao.ativo {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
  box-shadow: 0 12px 24px -16px rgba(47, 58, 160, .95);
}

.opcao.ativo::after {
  content: '';
  position: absolute;
  right: 14px; top: 50%;
  width: 6px; height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translateY(-62%) rotate(45deg);
}

.opcao-larga { grid-column: 1 / -1; }

/* Pílulas menores, para o troco */
.mini-opcoes { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.mini-opcao {
  padding: 8px 14px;
  border-radius: 11px;
  border: 1px solid var(--linha);
  background: var(--fundo);
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.mini-opcao:hover { transform: translateY(-1px); border-color: #c8cce4; }
.mini-opcao.ativo { background: var(--azul); border-color: var(--azul); color: #fff; }

/* Linha de produto */
.produto-linha {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--linha);
  border-radius: 16px;
  background: var(--carta);
  margin-bottom: 10px;
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1), border-color 180ms ease, box-shadow 200ms ease;
}

.produto-linha:hover {
  transform: translateY(-2px);
  border-color: #c8cce4;
  box-shadow: 0 12px 24px -20px rgba(20, 21, 31, .4);
}

.produto-linha.escolhido { border-color: var(--azul); background: #fafbff; }

.contador { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.contador button {
  width: 38px; height: 38px;
  border-radius: 12px;
  border: 1px solid var(--linha);
  background: var(--carta);
  color: var(--azul);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.contador button:hover { background: var(--azul-claro); border-color: var(--azul-claro); transform: scale(1.06); }
.contador button:active { transform: scale(.94); }
.contador span { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Resumo da venda */
.resumo-item-linha {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0;
  font-size: .9rem;
}

.resumo-item-linha span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

.resumo-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 14px;
  border-top: 1px solid var(--linha);
  font-size: 1.32rem; font-weight: 800; letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
}

.troco-resultado { font-size: .85rem; font-weight: 700; margin: 8px 0 0; }
.troco-resultado.ok { color: var(--verde); }
.troco-resultado.erro { color: var(--vermelho); }

/* Rodapé da venda */
.rodape-venda {
  position: sticky;
  bottom: 84px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1.7fr;
  gap: 10px;
  padding: 16px 0 10px;
  margin-top: 4px;
  background: linear-gradient(to top, var(--fundo) 0%, var(--fundo) 68%, rgba(251, 251, 254, 0) 100%);
}

.rodape-venda .botao {
  height: 54px;
  border-radius: 16px;
  font-size: .98rem;
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1), box-shadow 200ms ease, background 160ms ease;
}

.rodape-venda .botao:not(.botao-vazado) { box-shadow: 0 12px 26px -16px rgba(47, 58, 160, .85); }
.rodape-venda .botao:hover:not([disabled]) { transform: translateY(-2px); }
.rodape-venda .botao[disabled] { box-shadow: none; }
.rodape-venda .botao svg { width: 18px; height: 18px; }
.rodape-venda.solo { grid-template-columns: 1fr; }

/* Cliente escolhido */
.cliente-escolhido {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 17px;
  border: 1px solid var(--azul);
  border-radius: 18px;
  background: #fafbff;
  margin-bottom: 18px;
}

.botao-cliente {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--carta); border: 1px solid var(--linha); border-radius: 16px;
  padding: 14px 16px; margin-bottom: 10px; font: inherit; color: inherit;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: transform 190ms cubic-bezier(.2, .7, .3, 1), border-color 170ms ease, box-shadow 190ms ease;
}

.botao-cliente:hover {
  transform: translateY(-2px);
  border-color: #c8cce4;
  box-shadow: 0 12px 24px -20px rgba(20, 21, 31, .4);
}

.inicial {
  width: 40px; height: 40px; border-radius: 13px;
  background: var(--azul-claro); color: var(--azul);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .92rem; flex-shrink: 0;
}

.oculto { display: none !important; }

@media (min-width: 900px) {
  .rodape-venda { bottom: 20px; }
  .opcoes { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .etapa { animation: none; }
  .opcao:hover, .produto-linha:hover, .botao-cliente:hover, .rodape-venda .botao:hover { transform: none; }
  .contador button:hover { transform: none; }
}

/* ---------- Comprovante térmico ---------- */

/* Impressora térmica queima pontos: fonte fina sai falhada.
   Por isso, Arial em peso alto e Arial Black nos destaques. */
.papel {
  width: 58mm;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: Arial, "Helvetica Neue", Helvetica, "Liberation Sans", sans-serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  padding: 5mm 3mm;
  border-radius: 6px;
  -webkit-font-smoothing: none;
}

.papel img {
  display: block;
  height: 34px;
  margin: 0 auto 2px;
  object-fit: contain;
}

.papel hr {
  border: none;
  border-top: 1px dashed #000;
  margin: 4px 0;
}

.papel .par {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.papel .meio { text-align: center; }

.avanco { display: none; }

.papel .grosso {
  font-family: "Arial Black", "Arial Bold", Arial, sans-serif;
  font-weight: 900;
  letter-spacing: .01em;
}

.papel .total {
  font-family: "Arial Black", "Arial Bold", Arial, sans-serif;
  font-size: 13.5px;
  font-weight: 900;
  letter-spacing: 0;
}

@media print {
  /* Toda altura de página é preciosa: o que sobrar de conteúdo
     escorre para uma segunda página e a impressora corta no meio.
     Por isso aqui não há margem nem espaço sobrando em lugar nenhum. */
  html, body {
    margin: 0;
    padding: 0;
    background: #fff;
  }

  /* Nada além do comprovante vai para o papel.
     A mensagem de "venda registrada" também não. */
  .nao-imprime, .barra-inferior, .topo, .lateral, .aviso { display: none !important; }

  .conteudo { padding: 0; margin: 0; max-width: none; }

  .papel {
    /* A impressora imprime 48mm, mas a última coluna raspava na borda.
       46mm com 1mm de respiro de cada lado resolve, sem mexer na fonte. */
    width: 46mm;
    margin: 0;
    padding: 0 1mm 2mm;
    border-radius: 0;
    font-size: 11px;
    font-weight: 700;
    color: #000;
    overflow: visible;
    /* impede o navegador de clarear o preto na impressão */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .papel .total { font-size: 13.5px; }
  .papel hr { border-top: 1px dashed #000; margin: 3px 0; }

  /* Uma linha nunca se parte entre duas páginas. */
  .papel .par { page-break-inside: avoid; break-inside: avoid; }

  /* O rodapé de agradecimento fica grudado no total acima dele,
     para nunca ser empurrado sozinho para a página seguinte. */
  .papel .fecho { page-break-before: avoid; break-before: avoid; }

  /* A lâmina fica alguns centímetros depois da cabeça de impressão.
     O driver descarta espaço em branco no fim, então folga vazia não
     empurra papel nenhum — só tinta empurra. O traço abaixo força o
     avanço, e é ele que a lâmina pega, no lugar do texto.

     ESTE É O NÚMERO A MEXER: se voltar a cortar o agradecimento,
     aumente o 18mm. Se ainda sobrar papel, diminua. */
  .avanco { display: block; }

  .avanco span {
    display: block;
    border-top: 1px dashed #000;
    margin-top: 18mm;
    height: 0;
  }

  /* Só o primeiro traço avança o papel; os demais ficam ocultos. */
  .avanco span + span { display: none; }

  @page { size: 58mm auto; margin: 0; }
}

/* ---------- Painel ---------- */

.painel-topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 20px;
}

.painel-data { color: var(--tinta-fraca); font-size: .84rem; margin: 3px 0 0; text-transform: capitalize; }

@keyframes entrar {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Atalhos do topo */
.atalhos { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 30px; }

.atalho {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 17px 18px;
  border-radius: 20px;
  border: 1px solid var(--linha);
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(20, 21, 31, .04);
  overflow: hidden;
  animation: entrar 460ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform 220ms cubic-bezier(.2, .7, .3, 1),
              box-shadow 220ms ease, border-color 220ms ease;
}

.atalho:hover {
  transform: translateY(-3px);
  border-color: #c8cce4;
  box-shadow: 0 14px 28px -18px rgba(20, 21, 31, .38);
}

.atalho:active { transform: translateY(-1px); }

.atalho-icone {
  width: 46px; height: 46px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background: var(--azul-claro); color: var(--azul);
  flex-shrink: 0;
  transition: transform 220ms cubic-bezier(.2, .7, .3, 1), background 220ms ease;
}

.atalho:hover .atalho-icone { transform: scale(1.07) rotate(-3deg); }
.atalho-titulo { display: block; font-weight: 750; font-size: 1.04rem; letter-spacing: -.015em; }
.atalho-desc { display: block; font-size: .78rem; color: var(--tinta-fraca); margin-top: 1px; }

.atalho-principal {
  background: var(--azul);
  border-color: var(--azul);
  color: #fff;
  box-shadow: 0 10px 26px -16px rgba(47, 58, 160, .9);
}

.atalho-principal:hover {
  border-color: var(--azul-escuro);
  box-shadow: 0 18px 34px -18px rgba(47, 58, 160, .95);
}

.atalho-principal .atalho-icone { background: rgba(255, 255, 255, .18); color: #fff; }
.atalho-principal .atalho-desc { color: rgba(255, 255, 255, .82); }

/* Brilho que atravessa o cartão principal ao passar o mouse */
.atalho-principal::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .16), transparent);
  transform: skewX(-18deg);
  transition: left 620ms cubic-bezier(.3, .6, .3, 1);
}

.atalho-principal:hover::after { left: 120%; }

/* Cabeçalho da seção */
.bloco-cabeca {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}

.bloco-cabeca h2 { margin: 0; font-size: 1.08rem; letter-spacing: -.02em; }

.periodos { display: flex; gap: 2px; padding: 3px; background: #f1f2f7; border-radius: 12px; }

.periodo {
  padding: 6px 12px; border-radius: 9px; border: none; background: transparent;
  color: var(--tinta-fraca); font: inherit; font-size: .77rem; font-weight: 700;
  white-space: nowrap; cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.periodo:hover { color: var(--tinta); }
.periodo.ativo { background: var(--carta); color: var(--azul); box-shadow: 0 1px 3px rgba(20, 21, 31, .1); }

/* Cartões de número */
.numero {
  position: relative;
  display: block;
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: 20px;
  padding: 18px;
  overflow: hidden;
  color: inherit;
  box-shadow: 0 1px 2px rgba(20, 21, 31, .04);
  animation: entrar 460ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform 220ms cubic-bezier(.2, .7, .3, 1),
              box-shadow 220ms ease, border-color 220ms ease;
}

.numero::after {
  content: '';
  position: absolute;
  left: 18px; right: 18px; bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--azul);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 320ms cubic-bezier(.2, .7, .3, 1);
}

a.numero:hover, .numero.vivo:hover {
  transform: translateY(-3px);
  border-color: #c8cce4;
  box-shadow: 0 16px 30px -20px rgba(20, 21, 31, .4);
}

a.numero:hover::after, .numero.vivo:hover::after { transform: scaleX(1); }
.numero.verde::after { background: var(--verde); }
.numero.ambar::after { background: var(--ambar); }
.numero.vermelho::after { background: var(--vermelho); }

.numero-icone {
  width: 42px; height: 42px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--azul-claro); color: var(--azul);
  margin-bottom: 16px;
  transition: transform 240ms cubic-bezier(.2, .7, .3, 1);
}

.numero:hover .numero-icone { transform: scale(1.08) rotate(-4deg); }
.numero.verde .numero-icone { background: var(--verde-fundo); color: var(--verde); }
.numero.ambar .numero-icone { background: var(--ambar-fundo); color: var(--ambar); }
.numero.vermelho .numero-icone { background: var(--vermelho-fundo); color: var(--vermelho); }

.numero-rotulo {
  font-size: .69rem; font-weight: 800; letter-spacing: .075em;
  text-transform: uppercase; color: var(--tinta-fraca); margin: 0;
}

.numero-valor {
  font-size: 1.62rem; font-weight: 800; letter-spacing: -.04em;
  line-height: 1.15; margin: 5px 0 0;
  font-variant-numeric: tabular-nums;
}

.numero-valor.alerta { color: var(--vermelho); }

.numero-nota {
  font-size: .74rem; color: var(--tinta-fraca); margin: 6px 0 0;
  display: flex; align-items: center; gap: 4px;
}

.numero-nota svg { width: 12px; height: 12px; }
.numero-nota.subiu { color: var(--verde); font-weight: 700; }
.numero-nota.caiu { color: var(--vermelho); font-weight: 700; }
.numero-nota strong { color: var(--tinta); font-weight: 700; }

/* Listas do rodapé */
.secao-titulo {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-bottom: 12px;
}

.secao-titulo h2 { margin: 0; font-size: 1.04rem; letter-spacing: -.02em; }
.secao-titulo a { font-size: .78rem; font-weight: 700; color: var(--azul); }

.tudo-certo {
  display: flex; align-items: center; gap: 10px;
  padding: 18px;
  border: 1px solid var(--linha);
  border-radius: 18px;
  background: var(--carta);
  color: var(--tinta-fraca);
  font-size: .88rem;
}

.tudo-certo svg { width: 17px; height: 17px; color: var(--verde); flex-shrink: 0; }

/* Cartão de entrega, com o mesmo movimento */
.carta-viva {
  transition: transform 220ms cubic-bezier(.2, .7, .3, 1), box-shadow 220ms ease, border-color 220ms ease;
}

.carta-viva:hover {
  transform: translateY(-2px);
  border-color: #c8cce4;
  box-shadow: 0 14px 28px -20px rgba(20, 21, 31, .38);
}

.item { transition: transform 200ms cubic-bezier(.2, .7, .3, 1), border-color 200ms ease, box-shadow 200ms ease; }
a.item:hover { transform: translateY(-2px); border-color: #c8cce4; box-shadow: 0 12px 24px -20px rgba(20, 21, 31, .4); }

@media (prefers-reduced-motion: reduce) {
  .numero, .atalho { animation: none; }
  .numero:hover, .atalho:hover, a.item:hover, .carta-viva:hover { transform: none; }
  .numero:hover .numero-icone, .atalho:hover .atalho-icone { transform: none; }
  .atalho-principal::after { display: none; }
}

/* ---------- Formulários ---------- */

.cartao-form {
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: 22px;
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(20, 21, 31, .04);
  animation: entrar 460ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
  transition: border-color 220ms ease, box-shadow 220ms ease;
}

.cartao-form:focus-within {
  border-color: #c8cce4;
  box-shadow: 0 12px 28px -22px rgba(20, 21, 31, .4);
}

.form-secao {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--linha);
}

.form-secao-icone {
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--azul-claro); color: var(--azul);
  flex-shrink: 0;
}

.form-secao h2 { margin: 0; font-size: 1.02rem; letter-spacing: -.02em; }
.form-secao p { margin: 1px 0 0; font-size: .76rem; color: var(--tinta-fraca); }

.campo label {
  display: flex; align-items: baseline; gap: 5px;
  font-size: .79rem; font-weight: 700; margin-bottom: 7px;
  transition: color 160ms ease;
}

.campo:focus-within > label { color: var(--azul); }
.obrigatorio { color: var(--azul); font-weight: 800; }
.campo .dica { font-weight: 500; color: var(--tinta-fraca); font-size: .74rem; }

.cartao-form input, .cartao-form select, .cartao-form textarea {
  height: 50px;
  padding: 0 15px;
  border-radius: 14px;
  background: var(--fundo);
  border: 1px solid var(--linha);
  font-size: .94rem;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.cartao-form textarea { height: auto; padding: 13px 15px; min-height: 88px; }
.cartao-form input:hover, .cartao-form textarea:hover { border-color: #d3d6e6; }

.cartao-form input:focus, .cartao-form select:focus, .cartao-form textarea:focus {
  outline: none;
  background: var(--carta);
  border-color: var(--azul);
  box-shadow: 0 0 0 3px rgba(47, 58, 160, .12);
}

.cartao-form input.invalido {
  border-color: var(--vermelho);
  box-shadow: 0 0 0 3px rgba(198, 42, 42, .1);
}

/* Campo com prefixo (ícone dentro) */
.campo-com-icone { position: relative; }
.campo-com-icone input { padding-left: 44px; }

.campo-icone {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--tinta-fraca); pointer-events: none;
  transition: color 160ms ease;
}

.campo-icone svg { width: 18px; height: 18px; }
.campo-com-icone:focus-within .campo-icone { color: var(--azul); }

.erro-campo {
  display: none;
  font-size: .74rem;
  font-weight: 650;
  color: var(--vermelho);
  margin: 6px 0 0;
}

.erro-campo.visivel { display: block; }

.ajuda-campo { font-size: .74rem; color: var(--tinta-fraca); margin: 6px 0 0; }

/* Barra de ação */
.acoes-form {
  position: sticky;
  bottom: 84px;
  z-index: 20;
  /* A faixa opaca embaixo impede que o conteúdo rolando apareça em volta
     dos botões; o degradê no topo suaviza a emenda com a página. */
  padding: 16px 0 10px;
  margin-top: 4px;
  background: linear-gradient(to top, var(--fundo) 0%, var(--fundo) 68%, rgba(251, 251, 254, 0) 100%);
}

.acoes-form .botao {
  height: 54px;
  border-radius: 16px;
  font-size: 1rem;
  box-shadow: 0 12px 26px -16px rgba(47, 58, 160, .85);
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1), box-shadow 200ms ease, background 160ms ease;
}

.acoes-form .botao:hover:not([disabled]) {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -18px rgba(47, 58, 160, .9);
}

.acoes-form .botao svg { width: 18px; height: 18px; }
.acoes-form .botao[disabled] { box-shadow: none; }

.acoes-duplas { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }

@media (min-width: 900px) {
  .acoes-form { bottom: 20px; }
  .cartao-form { padding: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .cartao-form { animation: none; }
  .acoes-form .botao:hover { transform: none; }
}

/* ---------- Listas com movimento ---------- */

.lista-cartao {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--carta);
  border: 1px solid var(--linha);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 10px;
  color: inherit;
  animation: entrar 420ms cubic-bezier(.2, .7, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
  transition: transform 200ms cubic-bezier(.2, .7, .3, 1),
              border-color 180ms ease, box-shadow 200ms ease;
}

.lista-cartao:hover {
  transform: translateY(-2px);
  border-color: #c8cce4;
  box-shadow: 0 14px 26px -20px rgba(20, 21, 31, .42);
}

.lista-corpo { min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; }
.lista-texto { min-width: 0; }
.lista-titulo { font-weight: 700; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-apoio { font-size: .79rem; color: var(--tinta-fraca); margin: 1px 0 0; }
.lista-acoes { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.lista-cartao.critico { border-left: 4px solid var(--vermelho); }
.lista-cartao.baixo { border-left: 4px solid var(--ambar); }

/* Medidor de saldo */
.medidor { height: 4px; background: #eceef5; border-radius: 99px; overflow: hidden; margin-top: 7px; width: 100%; max-width: 190px; }
.medidor i { display: block; height: 100%; border-radius: 99px; background: var(--verde); transition: width 420ms cubic-bezier(.2, .7, .3, 1); }
.medidor i.baixo { background: var(--ambar); }
.medidor i.critico { background: var(--vermelho); }

/* Avatar com a inicial */
.inicial-cinza { background: #f1f2f7; color: var(--tinta-fraca); }

@media (prefers-reduced-motion: reduce) {
  .lista-cartao { animation: none; }
  .lista-cartao:hover { transform: none; }
}

/* ---------- Telas maiores ---------- */

@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: var(--lateral); }

  .barra-inferior, .topo { display: none; }

  .lateral {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--lateral);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    background: var(--carta);
    border-right: 1px solid var(--linha);
    z-index: 30;
  }

  .lateral-marca img { display: block; width: 100%; max-height: 110px; object-fit: contain; margin-bottom: 22px; }
  .lateral-menu { display: flex; flex-direction: column; gap: 4px; }
  .lateral-rodape { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--linha); display: flex; flex-direction: column; gap: 4px; }

  .menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    color: var(--tinta-fraca);
    font-weight: 650;
  }

  .menu-link:hover { background: var(--azul-claro); color: var(--azul); }
  .menu-link.ativo { background: var(--azul); color: #fff; }
  .menu-icone { display: flex; }

  .menu-usuario { padding: 10px 14px 4px; }
  .menu-usuario-nome { font-weight: 700; font-size: .85rem; margin: 0; }
  .menu-usuario-papel { font-size: .74rem; color: var(--tinta-fraca); margin: 0; }
  .menu-sair { color: var(--vermelho); }

  .conteudo { padding: 32px; }
  .grade-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grade-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .atalhos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .numero-valor { font-size: 1.78rem; }
  .numero { padding: 20px; }
  .duas-colunas { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
  h1 { font-size: 1.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .botao:active { transform: none; }
}
