/* Aplicativo (assets/pwa.js): convite pra instalar, passo a passo do iPhone, convite das notificações e avisos curtos.
   Carregado no login e no painel, por último. Usa as cores do app.css. No celular os diálogos sobem de baixo. */
.app-folha { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .5); opacity: 0; transition: opacity .18s ease; }
.app-folha.aberto { opacity: 1; }
.app-caixa { display: grid; justify-items: center; gap: 10px; width: min(400px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px 24px 22px; border-radius: 22px; background: var(--fundo); box-shadow: var(--sombra); text-align: center; transform: translateY(14px); transition: transform .24s cubic-bezier(.2, .8, .2, 1); }
.app-folha.aberto .app-caixa { transform: none; }
.app-caixa h2 { font-size: 20px; line-height: 1.25; font-weight: 700; letter-spacing: -.015em; color: var(--tinta); text-wrap: balance; }
.app-caixa p { font-size: 15px; line-height: 1.5; color: var(--mudo); text-wrap: balance; }
.app-caixa p b { color: var(--tinta); font-weight: 600; }
.app-logo { width: 68px; height: 68px; margin-bottom: 4px; border-radius: 17px; }
.app-ic { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 4px; border-radius: 50%; background: var(--marca-suave); color: var(--marca-forte); }
.app-btn { display: inline-flex; align-items: center; justify-content: center; width: 100%; height: 50px; margin-top: 6px; padding: 0 20px; border: 0; border-radius: 13px; background: var(--marca); color: var(--marca-texto); font: inherit; font-size: 16px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.app-btn:hover { background: var(--marca-forte); }
.app-btn[disabled] { opacity: .7; cursor: progress; }
.app-btn.sec { margin-top: 0; background: none; color: var(--mudo); font-weight: 500; }
.app-btn.sec:hover { background: var(--superficie); color: var(--tinta); }
.app-btn + .app-btn.sec { margin-top: -2px; }
.app-nota { padding: 10px 12px; border-radius: 12px; background: var(--superficie); font-size: 13.5px !important; }
.app-erro { width: 100%; padding: 9px 12px; border-radius: 10px; background: var(--erro-fundo); color: var(--erro) !important; font-size: 14px !important; font-weight: 500; }
.app-campo { display: grid; gap: 6px; width: 100%; margin-top: 4px; text-align: left; }
.app-campo span { font-size: 13.5px; font-weight: 500; color: var(--mudo); }
.app-campo select { width: 100%; height: 50px; padding: 0 14px; border: 1px solid var(--linha); border-radius: 13px; background: var(--fundo); color: var(--tinta); font: inherit; font-size: 16px; }
.app-campo select:focus { outline: 0; border-color: var(--tinta); box-shadow: inset 0 0 0 1px var(--tinta); }
.app-passos { display: grid; gap: 10px; width: 100%; margin: 6px 0 4px; padding: 0; list-style: none; counter-reset: passo; text-align: left; }
.app-passos li { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 12px; counter-increment: passo; font-size: 15px; line-height: 1.4; color: var(--tinta); }
.app-passos li::before { content: counter(passo); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--marca-suave); color: var(--marca-forte); font-size: 14px; font-weight: 700; }
.app-passos svg { display: inline-block; vertical-align: -4px; margin: 0 1px; color: var(--marca-forte); }
.app-passos b { font-weight: 600; }
.app-folha [hidden] { display: none !important; }

/* convite pra instalar: cartão flutuante embaixo, acima da barra de abas do celular */
.app-convite { position: fixed; z-index: 250; left: 12px; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 30px; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto; padding: 12px 8px 12px 12px; border-radius: 18px; background: var(--fundo); box-shadow: var(--sombra); opacity: 0; transform: translateY(16px); transition: opacity .2s ease, transform .26s cubic-bezier(.2, .8, .2, 1); }
.app-convite.aberto { opacity: 1; transform: none; }
.app-convite img { width: 46px; height: 46px; border-radius: 12px; }
.app-convite div { display: grid; gap: 1px; min-width: 0; }
.app-convite strong { font-size: 15px; line-height: 1.25; font-weight: 700; color: var(--tinta); }
.app-convite span { font-size: 12.5px; line-height: 1.3; color: var(--mudo); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-convite .app-btn { width: auto; height: 40px; margin: 0; padding: 0 16px; border-radius: 11px; font-size: 14.5px; }
.app-x { display: grid; place-items: center; width: 30px; height: 40px; padding: 0; border: 0; background: none; color: var(--mudo); font-size: 22px; line-height: 1; cursor: pointer; }
body:not(:has(.lateral)) .app-convite { bottom: calc(16px + env(safe-area-inset-bottom)); } /* tela de entrada: não há barra de abas */

.app-aviso { position: fixed; z-index: 320; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); padding: 12px 18px; border-radius: 14px; background: var(--tinta); color: var(--fundo); font-size: 14.5px; font-weight: 500; text-align: center; opacity: 0; transform: translate(-50%, 10px); transition: opacity .18s ease, transform .22s ease; }
.app-aviso.aberto { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 460px) { .app-convite span { display: none; } .app-convite { gap: 10px; } }
@media (max-width: 640px) {
  .app-folha { place-items: end center; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .app-caixa { width: 100%; padding: 26px 20px 16px; border-radius: 24px; transform: translateY(40px); }
}
@media (prefers-reduced-motion: reduce) { .app-folha, .app-caixa, .app-convite, .app-aviso { transition: none; } }


/* aba Conta, seção Notificações: interruptor igual ao dos alertas (classe própria: os de lá são pintados por outra rotina) e o seletor de estado */
.ap-chave { position: relative; flex: none; width: 48px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--mudo) 42%, var(--superficie)); transition: background-color .18s ease; cursor: pointer; }
.ap-chave::before { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--marca-texto); box-shadow: 0 1px 3px rgba(0, 0, 0, .28); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.ap-chave[aria-checked="true"] { background: var(--marca); }
.ap-chave[aria-checked="true"]::before { transform: translateX(20px); }
.ap-uf { max-width: 340px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--linha); }
.ap-select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--linha); border-radius: var(--raio-controle); background: var(--fundo); color: var(--tinta); font: inherit; font-size: 16px; font-weight: 500; }
.ap-select:focus { outline: 0; border-color: var(--tinta); box-shadow: inset 0 0 0 1px var(--tinta); }

/* ---------- Guia de instalação (aviso de novidade e "Instalar aplicativo"): seletor Android | iPhone, demonstração animada
   e os passos. No computador a demonstração fica ao lado dos passos; no celular, em cima. ---------- */
.app-guia-folha .app-caixa { position: relative; width: min(600px, 100%); }
.app-fecha { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; }
.app-fecha:hover { background: var(--superficie); color: var(--tinta); }
.app-so { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: min(340px, 100%); margin: 6px 0 2px; padding: 3px; border: 1px solid var(--linha); border-radius: 14px; background: var(--superficie); }
.app-so button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border: 0; border-radius: 11px; background: none; color: var(--mudo); font: inherit; font-size: 15px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.app-so button[aria-pressed="true"] { background: var(--fundo); color: var(--tinta); box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 0 0 1px var(--linha); }
.app-so button:first-child[aria-pressed="true"] svg { color: #3ddc84; } /* o verde do Android; a maçã fica na cor do texto */
.app-guia { display: grid; grid-template-columns: 168px minmax(0, 1fr); align-items: center; gap: 22px; width: 100%; margin: 8px 0 4px; text-align: left; }
.app-guia-txt { display: grid; gap: 12px; }
.app-guia .app-passos { margin: 0; gap: 12px; }
.app-guia .app-nota { text-align: left; }
/* o passo da cena que está passando fica em destaque (mesmo relógio da demonstração) */
.app-guia .app-passos li { opacity: .5; animation: app-passo 12s linear infinite backwards; animation-delay: calc(var(--i) * 3s - 12s); }
.app-guia .app-passos li:last-child { animation-name: app-passo-fim; }
.app-guia .app-passos li::before { transition: none; }
@keyframes app-passo { 0%, 25% { opacity: 1; } 27%, 100% { opacity: .5; } }
@keyframes app-passo-fim { 0%, 50% { opacity: 1; } 52%, 100% { opacity: .5; } }
.app-qr { display: grid; grid-template-columns: 84px minmax(0, 1fr); align-items: center; gap: 14px; width: 100%; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--superficie); text-align: left; }
.app-qr img { width: 84px; height: 84px; padding: 4px; border-radius: 8px; background: #fff; }
.app-qr span { font-size: 13.5px; line-height: 1.45; color: var(--mudo); }

/* o celular desenhado: 4 cenas de 3 s, uma por vez */
.app-fone { position: relative; width: 168px; height: 300px; margin: 0 auto; overflow: hidden; border: 5px solid #1c1f24; border-radius: 26px; background: #f5f6f7; color: #14171c; font-size: 9.5px; line-height: 1.25; user-select: none; }
.app-fone .cena { position: absolute; inset: 0; opacity: 0; animation: app-cena 12s linear infinite backwards; animation-delay: calc(var(--i) * 3s - 12s); }
@keyframes app-cena { 0% { opacity: 0; } 2%, 25% { opacity: 1; } 27%, 100% { opacity: 0; } }
.app-fone .toque { position: absolute; z-index: 5; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 96, 57, .28); box-shadow: 0 0 0 2px rgba(0, 96, 57, .85); opacity: 0; animation: app-toque 12s linear infinite backwards; animation-delay: calc(var(--i) * 3s - 12s); }
.app-fone .cena .toque { animation-delay: inherit; }
@keyframes app-toque { 0%, 7% { opacity: 0; transform: scale(.5); } 10% { opacity: 1; transform: scale(1); } 15% { opacity: 1; transform: scale(.78); } 19% { opacity: 1; transform: scale(1.2); } 24%, 100% { opacity: 0; transform: scale(1.2); } }
.app-fone svg { width: 12px; height: 12px; vertical-align: -2px; }
.app-fone .alvo { color: #006039; font-weight: 700; }
.fn-pagina { position: absolute; inset: 0; display: grid; align-content: start; gap: 7px; padding: 34px 8px 8px; }
.app-fone.ios .fn-pagina { padding-top: 10px; }
.fn-topo { display: flex; align-items: center; gap: 6px; }
.fn-topo img { width: 18px; height: 18px; border-radius: 5px; }
.fn-topo b { width: 62px; height: 7px; border-radius: 4px; background: #c9cdd3; }
.fn-cartao { height: 92px; border-radius: 9px; background: #fff; box-shadow: 0 0 0 1px #e3e5e9; }
.fn-cartao::before { content: ""; display: block; height: 54px; border-radius: 9px 9px 0 0; background: #dfe3e8; }
.fn-chrome { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: center; gap: 4px; height: 28px; padding: 0 5px 0 7px; background: #fff; box-shadow: 0 1px 0 #e3e5e9; }
.fn-url { height: 18px; padding: 0 8px; border-radius: 9px; background: #eef0f3; color: #5d6470; font-size: 8.5px; line-height: 18px; white-space: nowrap; overflow: hidden; }
.fn-pts { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #5d6470; }
.fn-pts.alvo { background: #e6f1ec; color: #006039; }
.fn-menu { position: absolute; z-index: 3; top: 26px; right: 5px; display: grid; width: 122px; padding: 4px 0; border-radius: 8px; background: #fff; box-shadow: 0 6px 18px rgba(0, 0, 0, .22), 0 0 0 1px #e3e5e9; }
.fn-menu span { padding: 6px 10px; }
.fn-menu .alvo, .fn-folha .alvo { background: #e6f1ec; }
.fn-veu { position: absolute; inset: 0; z-index: 2; background: rgba(0, 0, 0, .38); }
.fn-dialogo { position: absolute; z-index: 3; left: 8px; right: 8px; bottom: 10px; display: grid; gap: 10px; padding: 11px; border-radius: 12px; background: #fff; }
.fn-app { display: flex; align-items: center; gap: 8px; }
.fn-app img { width: 30px; height: 30px; border-radius: 8px; }
.fn-app span { display: grid; }
.fn-app b { font-size: 10.5px; }
.fn-app small { font-size: 8.5px; color: #5d6470; }
.fn-bts { display: flex; justify-content: flex-end; gap: 14px; font-weight: 600; color: #5d6470; }
.fn-bts .alvo { padding: 3px 9px; border-radius: 8px; background: #006039; color: #fff; }
.fn-safari { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; display: grid; gap: 5px; padding: 6px 8px 7px; background: #f7f7f8; box-shadow: 0 -1px 0 #dcdfe4; }
.fn-safari .fn-url { text-align: center; background: #e6e8ec; }
.fn-barra { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; color: #0a84ff; font-size: 13px; }
.fn-barra i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-style: normal; }
.fn-barra i.alvo { background: #e6f1ec; }
.fn-folha { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; gap: 1px; padding: 10px 8px 12px; border-radius: 14px 14px 0 0; background: #f2f2f5; }
.fn-folha span { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; background: #fff; }
.fn-folha span:first-child { border-radius: 9px 9px 0 0; }
.fn-folha span:last-child { border-radius: 0 0 9px 9px; }
.fn-add { position: absolute; inset: 0; background: #f2f2f5; }
.fn-add-topo { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 8px; background: #f7f7f8; box-shadow: 0 1px 0 #dcdfe4; color: #0a84ff; }
.fn-add-topo b { color: #14171c; font-size: 9.5px; }
.fn-add-topo .alvo { padding: 3px 7px; border-radius: 7px; background: #e6f1ec; }
.fn-add .fn-app { margin: 12px 8px; padding: 9px; border-radius: 10px; background: #fff; }
.fn-casa { display: grid; place-content: center; justify-items: center; gap: 16px; background: #00281a; }
.fn-icone { display: grid; justify-items: center; gap: 5px; color: #fff; font-size: 9px; }
.fn-icone img { width: 46px; height: 46px; border-radius: 12px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .18); }
.fn-pronto { padding: 4px 12px; border-radius: 999px; background: #4ade80; color: #06291b; font-size: 10px; font-weight: 700; }

@media (max-width: 640px) {
  .app-guia-folha .app-caixa { padding-top: 22px; }
  .app-guia-folha .app-logo { width: 52px; height: 52px; border-radius: 13px; }
  .app-guia { grid-template-columns: 132px minmax(0, 1fr); gap: 14px; }
  .app-fone { width: 132px; height: 236px; border-width: 4px; border-radius: 22px; font-size: 8px; }
  .app-fone .fn-cartao { height: 66px; } .app-fone .fn-cartao::before { height: 38px; }
  .app-fone .fn-menu { width: 104px; } .app-fone .fn-menu span { padding: 5px 8px; }
  .app-guia .app-passos li { grid-template-columns: 24px minmax(0, 1fr); gap: 9px; font-size: 14px; }
  .app-guia .app-passos li::before { width: 24px; height: 24px; font-size: 12.5px; }
}
/* quem pediu menos movimento vê só os passos, todos acesos */
@media (prefers-reduced-motion: reduce) { .app-guia { grid-template-columns: minmax(0, 1fr); } .app-demo { display: none; } .app-guia .app-passos li { opacity: 1; animation: none; } }
