/* ═══════════════════════════════════════════════════════════════════
   vitena · Área do cliente com cara de app nativo (22/11/2026)
   Só com html.ptn (prévia no "ver como", até liberar) e só até 899 px,
   onde a Área do cliente usa a barra de baixo. Computador não muda.
   Cores sólidas, Instrument Sans, tokens do tema (--ac-*).
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 899px) {
  @view-transition { navigation: auto; }

  html.ptn { background: var(--ac-fundo); touch-action: manipulation; }
  html.ptn body { -webkit-tap-highlight-color: transparent; }
  /* app instalado: a página não estica além do topo e do fim */
  html.ptn.ptn-pwa, html.ptn.ptn-pwa body { overscroll-behavior-y: none; }

  /* botões e navegação não abrem o menu de copiar nem selecionam texto sem querer */
  html.ptn .ac-barra, html.ptn .ac-subabas, html.ptn .ac-mais-cx, html.ptn .pt-btn,
  html.ptn button, html.ptn [role="tab"], html.ptn .ac-topo-av, html.ptn .ac-barra img {
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  }

  /* resposta ao toque, como nos apps do iPhone */
  html.ptn .ac-barra-i svg { transition: transform .12s; }
  html.ptn .ac-barra-i:active svg { transform: scale(.9); }
  html.ptn .ac-subabas a { transition: transform .1s, background .15s; }
  html.ptn .ac-subabas a:active { transform: scale(.96); }

  /* barra de baixo em celular pequeno: o nome cabe inteiro (ex.: Faturamento) */
  html.ptn .ac-barra { padding-left: 2px; padding-right: 2px; }
  html.ptn .ac-barra-i { padding-left: 1px; padding-right: 1px; }

  /* ── troca de tela ── */
  html.ptn .ac-barra { view-transition-name: ptn-barra; }
  html.ptn .pa-vc { view-transition-name: ptn-vc; }
  ::view-transition-group(ptn-barra), ::view-transition-group(ptn-vc) { animation-duration: 0s; }
  ::view-transition-old(ptn-barra), ::view-transition-old(ptn-vc) { display: none; }
  ::view-transition-new(ptn-barra), ::view-transition-new(ptn-vc) { animation: none; }

  /* padrão (aba, sub-aba, envio): esmaecer rápido */
  ::view-transition-old(root) { animation: ptn-some .12s ease both; }
  ::view-transition-new(root) { animation: ptn-surge .18s ease both; }
  /* entrar numa tela a partir do conteúdo: vem da direita */
  html[data-ptn-dir="vai"]::view-transition-old(root) { animation: ptn-recua .34s cubic-bezier(.2,.8,.2,1) both; }
  html[data-ptn-dir="vai"]::view-transition-new(root) { animation: ptn-entra .34s cubic-bezier(.2,.8,.2,1) both; box-shadow: -8px 0 24px -12px rgba(22,18,52,.28); }
  /* voltar: o contrário */
  html[data-ptn-dir="volta"]::view-transition-old(root) { animation: ptn-sai .3s cubic-bezier(.2,.8,.2,1) both; z-index: 2; box-shadow: -8px 0 24px -12px rgba(22,18,52,.28); }
  html[data-ptn-dir="volta"]::view-transition-new(root) { animation: ptn-avanca .3s cubic-bezier(.2,.8,.2,1) both; }

  /* barra fina de carregamento no alto, só quando a tela demora */
  .ptn-carga { position: fixed; left: 0; right: 0; top: env(safe-area-inset-top); height: 2px; z-index: 95; pointer-events: none; overflow: hidden; opacity: 0; transition: opacity .15s; }
  .ptn-carga.on { opacity: 1; }
  .ptn-carga::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: var(--ac-acento); border-radius: 2px; animation: ptn-corre 1s cubic-bezier(.4,0,.2,1) infinite; }
  @media (prefers-color-scheme: dark) { .ptn-carga::before { background: var(--ac-lilas); } }

  /* ── área de toque de 44 px, sem mudar o desenho (camada invisível) ── */
  html.ptn .ac-subabas { padding-top: 5px; padding-bottom: 7px; margin-top: -3px; margin-bottom: 13px; }
  /* (.pt-modal-x e .pt-olho já são absolutos) */
  html.ptn .pt-btn-sm, html.ptn .pt-app-bt, html.ptn .pt-app-x, html.ptn .ac-subabas a, html.ptn .pt-seg a { position: relative; }
  html.ptn .pt-btn-sm::after, html.ptn .pt-app-bt::after, html.ptn .pt-app-x::after, html.ptn .ac-subabas a::after, html.ptn .pt-seg a::after,
  html.ptn .pt-modal-x::after, html.ptn .pt-olho::after {
    content: ""; position: absolute;
    top: min(0px, calc(50% - 22px)); bottom: min(0px, calc(50% - 22px));
    left: min(0px, calc(50% - 22px)); right: min(0px, calc(50% - 22px));
  }

  /* links soltos no conteúdo (marcados pelo portal-nativo.js só quando têm menos de 40 px):
     no meio do texto, o enchimento vertical aumenta o toque sem mexer na linha;
     em bloco, a mesma camada invisível dos botões */
  html.ptn a.ptn-toque { padding-top: 12px; padding-bottom: 12px; }
  html.ptn a.ptn-toque-ab { position: relative; }
  html.ptn a.ptn-toque-ab::after { content: ""; position: absolute; top: min(0px, calc(50% - 22px)); bottom: min(0px, calc(50% - 22px)); left: min(0px, calc(50% - 22px)); right: min(0px, calc(50% - 22px)); }

  /* ── folha "Mais": sobe com animação, pegador, fecha puxando ── */
  html.ptn .ac-mais:not([hidden]) { animation: ptn-surge .2s ease both; }
  html.ptn .ac-mais:not([hidden]) .ac-mais-cx { animation: ptn-sobe .26s cubic-bezier(.2,.8,.2,1) both; }
  html.ptn .ac-mais.ptn-fecha { animation: ptn-some .18s ease both; }
  html.ptn .ac-mais.ptn-fecha .ac-mais-cx { animation: ptn-desce .2s ease-in both; }
  html.ptn .ac-mais-cx { padding-top: 18px; touch-action: pan-x; }
  html.ptn .ac-mais-cx::before, html.ptn .pt-modal-cx::before {
    content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--ac-linha-2);
  }
  html.ptn .ac-mais-cx.ptn-puxando, html.ptn .pt-modal-cx.ptn-puxando { animation: none !important; transition: none !important; }

  /* janelas (Pix, confiar no aparelho, avisos): pegador e fecha puxando */
  html.ptn .pt-modal:not([hidden]) { animation: ptn-surge .18s ease both; }
  html.ptn .pt-modal.ptn-fecha { animation: ptn-some .18s ease both; }
  html.ptn .pt-modal.ptn-fecha .pt-modal-cx { animation: ptn-desce .2s ease-in both; }

  /* ── puxar para atualizar ── */
  .ptn-puxa { position: fixed; left: 50%; top: calc(8px + env(safe-area-inset-top)); z-index: 96; width: 38px; height: 38px; margin-left: -19px;
    display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--ac-sup); color: var(--ac-acento-txt);
    box-shadow: 0 2px 4px rgba(22,18,52,.06), 0 10px 24px -12px rgba(22,18,52,.35);
    transform: translateY(-60px) scale(.6); opacity: 0; pointer-events: none; }
  .ptn-puxa svg { width: 20px; height: 20px; transition: transform .15s; }
  .ptn-puxa.pronto svg { transform: rotate(180deg); }
  .ptn-puxa.gira svg { animation: ptn-gira .8s linear infinite; }
  .ptn-puxa.solta { transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .2s; }

  /* ── arrastar da borda para voltar ── */
  html.ptn-arrastando .ac-app { will-change: transform; }
}

@media (max-width: 639px) {
  html.ptn .pt-modal-cx { padding-top: 26px; touch-action: pan-y; }
}
@media (min-width: 640px) {
  html.ptn .pt-modal-cx::before { display: none; }
}
@media (max-width: 380px) {
  html.ptn .ac-barra-i { font-size: calc(11.5px * var(--vt-fs, 1)); letter-spacing: -0.02em; }
}

@keyframes ptn-entra { from { transform: translateX(100%); } to { transform: none; } }
@keyframes ptn-recua { from { transform: none; opacity: 1; } to { transform: translateX(-28%); opacity: .6; } }
@keyframes ptn-sai { from { transform: none; } to { transform: translateX(100%); } }
@keyframes ptn-avanca { from { transform: translateX(-28%); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes ptn-some { to { opacity: 0; } }
@keyframes ptn-surge { from { opacity: 0; } }
@keyframes ptn-sobe { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes ptn-desce { to { transform: translateY(60px); opacity: 0; } }
@keyframes ptn-corre { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@keyframes ptn-gira { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  html.ptn .ac-mais-cx, html.ptn .pt-modal-cx, html.ptn .ac-mais, html.ptn .pt-modal { animation: none !important; }
}
