/* Botão "Instalar app" e a explicação de como instalar (js/instalar.js, docs/arquitetura.md [ARQ-6]). Usado no menu, no
   painel e nas páginas iniciais das casas: cores neutras e a cor da casa (--mn-primaria), com reserva para quem não tem.
   Animações: a seta desce e volta, um brilho atravessa o botão de tempos em tempos e o ícone pulsa; "menos movimento" desliga. */
html:not(.pode-instalar) [data-instalar] { display: none !important; }
/* as páginas iniciais das casas têm fontes de título e estilos próprios para h2, p, li...: aqui vale sempre a fonte do sistema */
:is(.inst-flut, .inst-fundo, .inst-aviso) :is(h2, p, ol, ul, li, span, b, small, em, i, button) {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; text-transform: none; letter-spacing: normal; }

.inst-flut, .inst-fundo, .inst-aviso, .inst-topo, .entrada-instalar {
  --inst-cor: var(--mn-primaria, #ff5148);
  --inst-escura: color-mix(in srgb, var(--inst-cor) 72%, #000);
  --inst-grad: linear-gradient(135deg, color-mix(in srgb, var(--inst-cor) 82%, #fff), var(--inst-cor) 45%, var(--inst-escura));
  --inst-mola: cubic-bezier(.2, 1.35, .4, 1);
}

/* seta que desce e volta (em todo botão de instalar) */
.inst-seta-mov { transform-box: fill-box; animation: inst-bob 1.6s ease-in-out infinite; }
@keyframes inst-bob { 0%, 100% { transform: translateY(-1.5px); } 50% { transform: translateY(2px); } }
/* brilho que atravessa o botão */
@keyframes inst-brilho { 0%, 70% { transform: translateX(-120%) skewX(-20deg); } 100% { transform: translateX(260%) skewX(-20deg); } }
@keyframes inst-pulso { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--inst-cor) 55%, transparent); } 100% { box-shadow: 0 0 0 12px transparent; } }

/* ------------------------------------------------ botão flutuante (páginas iniciais) */
.inst-flut { position: fixed; z-index: 900; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 24px; width: min(400px, calc(100vw - 24px)); box-sizing: border-box;
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid rgba(255, 255, 255, .7); color: #151515;
  box-shadow: 0 22px 44px -14px rgba(10, 10, 20, .42), 0 3px 10px rgba(10, 10, 20, .1);
  font: 15px/1.2 system-ui, -apple-system, 'Segoe UI', sans-serif; animation: inst-entra .6s var(--inst-mola) .4s backwards; transition: opacity .25s, transform .25s; }
.inst-flut.saindo { opacity: 0; transform: translate(-50%, 20px) scale(.96); }
@keyframes inst-entra { from { opacity: 0; transform: translate(-50%, 40px) scale(.9); } }
.inst-flut-bt { position: relative; flex: 1; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 4px 6px 4px 4px; border: 0; border-radius: 18px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; overflow: hidden; transition: transform .2s; }
.inst-flut-bt:active { transform: scale(.97); }
.inst-flut-bt::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 40%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent); animation: inst-brilho 5.5s ease-in-out 1.6s infinite; }
.inst-flut-ic { display: grid; place-items: center; width: 46px; height: 46px; flex: none; border-radius: 13px; overflow: hidden;
  background: var(--inst-grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .45); animation: inst-pulso 2.2s ease-out 1.2s 3; }
.inst-flut-ic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inst-flut-ic svg { width: 24px; height: 24px; }
.inst-flut-tx { flex: 1; display: grid; gap: 2px; min-width: 0; }
.inst-flut-tx b { font-size: 15.5px; font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.inst-flut-tx small { font-size: 12.5px; font-weight: 600; color: #6b6b72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inst-flut-seta { display: grid; place-items: center; width: 40px; height: 40px; flex: none; margin-left: 4px; border-radius: 50%;
  background: var(--inst-grad); color: #fff; box-shadow: 0 8px 18px -6px color-mix(in srgb, var(--inst-cor) 75%, transparent); }
.inst-flut-seta svg { width: 20px; height: 20px; }
.inst-flut-x { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 0; border-radius: 50%; background: transparent; color: #8a8a92; cursor: pointer; }
.inst-flut-x svg { width: 16px; height: 16px; }
.inst-flut-x:hover { background: rgba(0, 0, 0, .06); color: #333; }

/* ------------------------------------------------ menu do cliente: botão no topo */
.pd-topo-bt.inst-topo { position: relative; overflow: hidden; border-color: transparent; background: var(--inst-grad); color: #fff;
  box-shadow: 0 8px 18px -8px color-mix(in srgb, var(--inst-cor) 80%, transparent); animation: inst-pulso 2.2s ease-out 1.5s 3; transition: transform .2s; }
.pd-topo-bt.inst-topo:active { transform: scale(.94); }
.pd-topo-bt.inst-topo::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 45%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent); animation: inst-brilho 6s ease-in-out 2s infinite; }
.inst-topo span { display: none; }
@media (min-width: 761px) {
  .pd-topo-bt.inst-topo { display: flex; align-items: center; width: auto; gap: 8px; padding: 0 18px 0 13px; border-radius: 999px;
    font: 800 14px/1 var(--mn-corpo, system-ui, sans-serif); white-space: nowrap; }
  .inst-topo span { display: inline; }
}

/* ------------------------------------------------ painel: tela de entrada e menu da conta */
.entrada-instalar { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 46px;
  padding: 0 20px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--inst-cor) 28%, transparent);
  background: color-mix(in srgb, var(--inst-cor) 9%, #fff); color: var(--inst-escura); font-family: inherit; font-size: 14.5px; font-weight: 800; line-height: 1;
  cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.entrada-instalar:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--inst-cor) 14%, #fff);
  box-shadow: 0 10px 22px -12px color-mix(in srgb, var(--inst-cor) 80%, transparent); }
.entrada-instalar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 35%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent); animation: inst-brilho 6s ease-in-out 1.5s infinite; }
.entrada-instalar svg { width: 19px; height: 19px; }
/* painel: cartão no fim do menu de módulos (☰), com o ícone do oMenu */
.ml-instalar { --inst-cor: #ff5148; --inst-grad: linear-gradient(135deg, #ff8a3d, #ff5148 50%, #ff2e63);
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 16px; padding: 10px 12px 10px 10px;
  border: 0; border-radius: 18px; background: linear-gradient(135deg, #fff4ec, #ffe9ef); color: #2a1a1f; text-align: left; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 81, 72, .22); transition: transform .2s, box-shadow .2s; }
.ml-instalar:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px rgba(255, 81, 72, .4), 0 12px 24px -14px rgba(255, 46, 99, .6); }
.ml-instalar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 35%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .8), transparent); animation: inst-brilho 6s ease-in-out 1s infinite; }
.ml-instalar-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 14px -6px rgba(255, 46, 99, .7); }
.ml-instalar-ic img { width: 100%; height: 100%; display: block; }
.ml-instalar-tx { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ml-instalar-tx strong { font-size: 14.5px; font-weight: 800; }
.ml-instalar-tx small { font-size: 12px; font-weight: 600; color: #7a5a62; }
.ml-instalar-seta { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--inst-grad); color: #fff; }
.ml-instalar-seta svg { width: 18px; height: 18px; }
.conta-pop [data-instalar] .inst-seta-mov { animation: none; }
.conta-pop [data-instalar]:hover .inst-seta-mov { animation: inst-bob 1.6s ease-in-out infinite; }

/* ------------------------------------------------ explicação (folha que sobe de baixo) */
.inst-fundo { position: fixed; inset: 0; z-index: 1000; display: grid; align-items: end; justify-items: center;
  background: rgba(12, 10, 18, 0); transition: background .3s, -webkit-backdrop-filter .3s, backdrop-filter .3s; }
.inst-fundo.aberta { background: rgba(12, 10, 18, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.inst-folha { position: relative; width: 100%; max-width: 460px; box-sizing: border-box; padding: 10px 22px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 28px 28px 0 0; background: #fff; color: #18181b; font: 15px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, .35); transform: translateY(105%); transition: transform .42s cubic-bezier(.2, .9, .25, 1); }
.inst-fundo.aberta .inst-folha { transform: none; }
.inst-pega { display: block; width: 40px; height: 5px; margin: 0 auto 16px; border-radius: 99px; background: #dcdce2; }
.inst-cab { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.inst-app-ic { display: grid; place-items: center; width: 64px; height: 64px; flex: none; border-radius: 17px; overflow: hidden;
  background: var(--inst-grad); color: #fff; box-shadow: 0 12px 26px -10px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .05);
  transform: scale(.6) rotate(-8deg); opacity: 0; transition: transform .5s var(--inst-mola) .12s, opacity .3s .12s; }
.inst-fundo.aberta .inst-app-ic { transform: none; opacity: 1; }
.inst-app-ic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inst-app-ic svg { width: 30px; height: 30px; }
.inst-cab h2 { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 800; letter-spacing: -.015em; }
.inst-cab p { margin: 3px 0 0; font-size: 13px; color: #8a8a93; }
.inst-sub { margin: 0 0 12px; font-size: 14px; color: #5b5b63; }
.inst-vant, .inst-passos { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.inst-vant li, .inst-passos li { display: flex; align-items: center; gap: 13px; padding: 10px 12px; border-radius: 16px; background: #f6f6f8;
  opacity: 0; transform: translateY(10px); transition: opacity .35s, transform .45s var(--inst-mola); }
.inst-fundo.aberta .inst-vant li, .inst-fundo.aberta .inst-passos li { opacity: 1; transform: none; }
.inst-vant li:nth-child(1), .inst-passos li:nth-child(1) { transition-delay: .16s; }
.inst-vant li:nth-child(2), .inst-passos li:nth-child(2) { transition-delay: .24s; }
.inst-vant li:nth-child(3), .inst-passos li:nth-child(3) { transition-delay: .32s; }
.inst-vant li:nth-child(4), .inst-passos li:nth-child(4) { transition-delay: .40s; }
.inst-vant i, .inst-passos i { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px;
  background: color-mix(in srgb, var(--inst-cor) 13%, #fff); color: var(--inst-escura); }
.inst-vant svg, .inst-passos i svg { width: 21px; height: 21px; }
.inst-vant span, .inst-passos span { font-size: 14.5px; font-weight: 600; color: #2a2a30; }
.inst-passos b { font-weight: 800; color: #111; }
.inst-passos li { position: relative; }
.inst-passos em { position: absolute; left: 4px; top: 4px; z-index: 1; display: grid; place-items: center; min-width: 19px; height: 19px; border-radius: 99px;
  background: var(--inst-grad); color: #fff; font: 800 11px/1 system-ui, sans-serif; font-style: normal; box-shadow: 0 0 0 2px #f6f6f8; }
.inst-acoes { display: grid; gap: 6px; }
.inst-bt-pri { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border: 0;
  border-radius: 17px; background: var(--inst-grad); color: #fff; font: 800 16px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; cursor: pointer;
  box-shadow: 0 14px 28px -12px color-mix(in srgb, var(--inst-cor) 85%, transparent); transition: transform .2s; }
.inst-bt-pri:active { transform: scale(.98); }
.inst-bt-pri::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 35%; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent); animation: inst-brilho 4.5s ease-in-out 1s infinite; }
.inst-bt-pri svg { width: 21px; height: 21px; }
.inst-bt-sec { height: 44px; border: 0; border-radius: 14px; background: transparent; color: #6b6b73; font: 700 15px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; cursor: pointer; }
.inst-bt-sec:hover { background: #f3f3f5; }
@media (min-width: 700px) {
  .inst-fundo { align-items: center; padding: 24px; }
  .inst-folha { border-radius: 28px; padding-bottom: 22px; transform: translateY(24px) scale(.96); opacity: 0; transition: transform .4s var(--inst-mola), opacity .25s; }
  .inst-fundo.aberta .inst-folha { opacity: 1; }
  .inst-pega { display: none; }
  .inst-cab { margin-top: 8px; }
}

/* ------------------------------------------------ aviso "Pronto!" depois de instalar */
.inst-aviso { position: fixed; z-index: 1001; left: 50%; top: calc(16px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); box-sizing: border-box; padding: 10px 18px 10px 10px; border-radius: 999px; background: #17171c; color: #fff;
  font: 700 14.5px/1.3 system-ui, -apple-system, 'Segoe UI', sans-serif; box-shadow: 0 16px 36px -12px rgba(0, 0, 0, .5);
  transform: translateX(-50%); animation: inst-desce .5s var(--inst-mola) backwards; transition: opacity .3s, transform .3s; }
.inst-aviso.saindo { opacity: 0; transform: translate(-50%, -12px); }
.inst-aviso i { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: #22c55e; color: #fff; }
.inst-aviso svg { width: 16px; height: 16px; }
@keyframes inst-desce { from { opacity: 0; transform: translate(-50%, -24px); } }

@media (prefers-reduced-motion: reduce) {
  .inst-flut, .inst-aviso, .inst-flut-ic, .pd-topo-bt.inst-topo, .inst-seta-mov,
  .inst-flut-bt::after, .pd-topo-bt.inst-topo::after, .entrada-instalar::after, .ml-instalar::after, .inst-bt-pri::after { animation: none !important; }
  .inst-folha, .inst-app-ic, .inst-vant li, .inst-passos li { transition: none !important; }
}
