/* =========================================================
   Sistemas Rem · Automações: "mesa" de telas reais (20/11)
   Chega a notificação de venda; quatro mini-telas numa mesa 3D
   ganham vida uma por vez e levantam na direção de quem vê:
   área de membros (cadeado abre), e-mail (mensagem nova entra),
   WhatsApp (balão chega, tiques azuis), planilha (linha nova).
   Passos tocados pelo motor de cenas (movimento.js):
   data-s="n" ganha .on no passo n; data-ate="n" ganha .fora depois.
   Sem JS ou com movimento reduzido: tudo no estado final.
   ========================================================= */
.amesa { margin: .2rem 0 .3rem; }
.amesa .ic { width: 1em; height: 1em; flex: none; }
.amesa b, .amesa em, .amesa small { font-style: normal; }
.js .amesa [data-s], .js .amesa [data-ate] { transition: opacity .35s var(--ease), transform .55s cubic-bezier(.3, 1.45, .55, 1); }

/* ---------- Topo: espera → notificação de venda → selo ---------- */
.at-topo { position: relative; height: 54px; margin-bottom: 1.1rem; }
.at-espera, .at-toast, .at-selo { position: absolute; inset: 0; display: flex; align-items: center; border-radius: 14px; }
.at-espera { justify-content: center; gap: .5rem; border: 1px dashed rgba(200, 214, 235, .28); font-size: .72rem; color: var(--apagado); }
.at-espera i { width: 7px; height: 7px; border-radius: 50%; background: var(--acento); animation: atPisca 1.2s ease-in-out infinite; }
@keyframes atPisca { 50% { opacity: .25; } }
.at-toast { gap: .7rem; padding: 0 .9rem; background: #1c2a40; border: 1px solid rgba(200, 214, 235, .3); box-shadow: 0 18px 36px -16px rgba(199, 243, 107, .65); }
.at-ic { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; font-size: 1.15rem; color: #101d32; background: linear-gradient(135deg, #b5ea4c, #b5ea4c); }
.at-txt { display: grid; line-height: 1.25; }
.at-txt b { font-size: .8rem; color: var(--texto); }
.at-txt small { font-size: .64rem; color: var(--suave); }
.at-toast em { margin-left: auto; font-size: .95rem; font-weight: 800; color: #d4f78a; }
.at-selo { justify-content: center; gap: .45rem; font-size: .8rem; font-weight: 800; color: #101d32; background: linear-gradient(115deg, #b5ea4c, #d4f78a); box-shadow: 0 18px 36px -14px rgba(181, 234, 76, .8); }
.js .at-espera.fora { opacity: 0; transform: scale(.96); }
.js .at-toast:not(.on) { opacity: 0; transform: translateY(-20px) scale(.95); }
.js .at-toast.fora { opacity: 0; transform: scale(.96); }
.js .at-selo:not(.on) { opacity: 0; transform: scale(.88); }

/* ---------- Mesa 3D ---------- */
.at-mesa { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; perspective: 900px; perspective-origin: 50% 0%; }
.jw {
  position: relative; display: flex; flex-direction: column; height: 134px; border-radius: 14px; overflow: hidden;
  background: #162133; border: 1px solid rgba(200, 214, 235, .18);
  transform: rotateX(18deg) scale(.96); transform-origin: 50% 100%;
  transition: transform .65s cubic-bezier(.3, 1.45, .55, 1), opacity .4s var(--ease), border-color .4s, box-shadow .5s var(--ease);
}
.js .jw { opacity: .5; }
/* a tela da vez levanta e acende */
.jw:has(.jw-luz.on:not(.fora)) { opacity: 1; transform: rotateX(0) translateZ(48px) translateY(-6px); border-color: rgba(199, 243, 107, .8); box-shadow: 0 28px 50px -18px rgba(199, 243, 107, .7); z-index: 2; }
/* feita: volta para a mesa, inteira e com o check */
.jw:has(.jw-ok.on) { opacity: 1; border-color: rgba(61, 220, 132, .35); }
.jw-luz { position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none; opacity: 0; overflow: hidden; }
.jw-luz::after { content: ''; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 35%, rgba(199, 243, 107, .22) 50%, transparent 65%); transform: translateX(-110%); }
.jw-luz.on:not(.fora) { opacity: 1; }
.jw-luz.on:not(.fora)::after { transform: translateX(110%); transition: transform 1s var(--ease-io) .1s; }

.jw-barra { display: flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; flex: none; background: #1c2a40; font-size: .58rem; color: var(--suave); }
.jw-barra > i { width: 5px; height: 5px; border-radius: 50%; background: #ff5f57; }
.jw-barra > i:nth-child(2) { background: #febc2e; }
.jw-barra > i:nth-child(3) { background: #28c840; }
.jw-barra > span { display: flex; align-items: center; gap: .3rem; margin-left: 5px; font-weight: 600; color: var(--texto-2); }
.jw-barra > span .ic { font-size: .8rem; color: var(--acento); }
.jw-ok { display: grid; place-items: center; width: 16px; height: 16px; margin-left: auto; border-radius: 50%; font-size: .6rem; color: #062a17; background: #3ddc84; }
.js .jw-ok:not(.on) { opacity: 0; transform: scale(.3); }
.jw-corpo { position: relative; flex: 1; min-height: 0; padding: 10px; }

/* 1 · Área de membros */
.jw-membros .jw-corpo { display: grid; justify-items: center; align-content: center; gap: 5px; }
.mb-cad { position: relative; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; font-size: 1.15rem; color: var(--suave); background: rgba(255, 255, 255, .06); transition: background .35s, color .35s; }
.mb-cad > .ic, .mb-aberto { grid-area: 1 / 1; }
.mb-aberto { display: grid; place-items: center; }
.mb-cad:has(.mb-aberto.on), html:not(.js) .mb-cad { color: #3ddc84; background: rgba(61, 220, 132, .14); }
.mb-cad > .mb-fechado { transition: opacity .25s var(--ease); }
.mb-cad:has(.mb-aberto.on) > .mb-fechado, html:not(.js) .mb-fechado { opacity: 0; }
.js .mb-aberto:not(.on) { opacity: 0; transform: scale(.6) rotate(-25deg); }
.mb-ola { display: grid; font-size: .66rem; }
.mb-ola b { grid-area: 1 / 1; text-align: center; }
.mb-anon { color: var(--apagado); font-weight: 600; }
.mb-nome { color: var(--texto); font-weight: 800; }
html:not(.js) .mb-anon { opacity: 0; }
.js .mb-anon.fora { opacity: 0; transform: translateY(-6px); }
.js .mb-nome:not(.on) { opacity: 0; transform: translateY(6px); }
.mb-chip { padding: .18rem .5rem; border-radius: 999px; font-size: .54rem; font-weight: 700; color: #3ddc84; background: rgba(61, 220, 132, .12); border: 1px solid rgba(61, 220, 132, .3); }
.js .mb-chip:not(.on) { opacity: 0; transform: scale(.8); }

/* 2 · E-mail: a mensagem nova entra no topo e empurra as outras */
.em-caixa { overflow: hidden; padding: 7px 8px; }
.em-lista { display: grid; gap: 4px; }
.js .amesa .em-lista { transition: transform .6s var(--ease); }
.js .em-lista:not(.on) { transform: translateY(-26px); }
.em-linha { display: flex; align-items: center; gap: 6px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: .58rem; background: rgba(255, 255, 255, .035); }
.em-linha i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, .15); }
.em-linha em { flex: 1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); }
.em-linha small { margin-left: auto; font-size: .5rem; color: var(--apagado); }
.em-nova { background: rgba(199, 243, 107, .14); }
.em-nova i { background: var(--acento); box-shadow: 0 0 6px var(--acento); }
.em-nova b { flex: 1; color: var(--texto); font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.em-nova { transition: opacity .35s var(--ease) .15s; }
.js .em-lista:not(.on) .em-nova { opacity: 0; }

/* 3 · WhatsApp */
.zp-chat { display: flex; align-items: flex-end; justify-content: flex-end; background: radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1.3px) 0 0 / 10px 10px; }
.zp-bl { position: relative; max-width: 88%; padding: .4rem .6rem 1rem; border-radius: 11px 11px 3px 11px; font-size: .6rem; line-height: 1.35; color: #e9fff6; background: #075e4b; transform-origin: 100% 100%; }
.js .zp-bl:not(.on) { opacity: 0; transform: translateY(12px) scale(.82); }
.zp-vis { position: absolute; right: 7px; bottom: 3px; display: grid; font-size: .78rem; }
.zp-vis .ic, .zp-azul { grid-area: 1 / 1; }
.zp-cinza { color: #9fb8ad; }
.zp-azul { display: grid; color: #53bdeb; }
html:not(.js) .zp-cinza { opacity: 0; }
.js .zp-azul:not(.on) { opacity: 0; transform: none; }

/* 4 · Planilha */
.pl-tab { display: grid; align-content: start; gap: 3px; padding: 8px; }
.pl-l { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; align-items: center; height: 18px; padding: 0 7px; border-radius: 4px; font-size: .58rem; }
.pl-cab b { font-family: var(--f-mono); font-size: .5rem; letter-spacing: .08em; text-transform: uppercase; color: var(--apagado); }
.pl-l em { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .08); }
.pl-l em.curta { width: 60%; }
.pl-nova { background: rgba(199, 243, 107, .16); box-shadow: inset 0 0 0 1px rgba(199, 243, 107, .45); transform-origin: 50% 0; }
.pl-nova b { color: var(--texto); font-weight: 700; }
.pl-nova b + b { color: #d4f78a; }
.js .pl-nova:not(.on) { opacity: 0; transform: translateY(-6px) scaleY(.4); }

/* ---------- Cronômetro do rodapé ---------- */
.rd-tempo { display: inline-grid; vertical-align: bottom; }
.rd-tempo b { grid-area: 1 / 1; font-variant-numeric: tabular-nums; color: var(--texto); transition: opacity .2s var(--ease), transform .3s var(--ease); }
.js .rd-tempo b[data-s]:not(.on), .js .rd-tempo b.fora { opacity: 0; transform: translateY(5px); }
html:not(.js) .rd-tempo b:not(:last-child) { opacity: 0; }

/* pausa o que pisca quando o painel está fora da tela */
.js .auto-fluxo:not(.rodando) .at-espera i { animation-play-state: paused; }

@media (max-width: 520px) {
  .at-mesa { gap: .6rem; }
  .jw { height: 124px; }
  .jw-barra > span { font-size: .52rem; margin-left: 0; white-space: nowrap; }
  .jw-barra > i, .em-linha small { display: none; }
  .zp-bl { font-size: .55rem; }
  .at-txt b { font-size: .74rem; }
}

/* =========================================================
   3D (20/11): a mesa inteira em perspectiva, notificação flutuando
   acima, telas com espessura que descem do fundo na entrada, a da
   vez sobe alto. O mouse inclina a mesa (JS em movimento.js); sem
   mouse, ela balança de leve sozinha.
   ========================================================= */
.auto-fluxo { perspective: 1200px; perspective-origin: 50% 30%; }
.amesa { margin: 1.9rem 0 1.4rem; transform-style: preserve-3d; transform: rotateX(12deg); transition: transform .8s var(--ease); }
.amesa.no-mouse { transition-duration: .25s; }
.at-topo { transform: translateZ(45px); transform-style: preserve-3d; }
.at-toast, .at-selo { box-shadow: 0 30px 40px -18px rgba(0, 0, 0, .8), 0 18px 36px -16px rgba(199, 243, 107, .6); }
.at-mesa { perspective: none; transform-style: preserve-3d; animation: atBalanca 7s ease-in-out infinite; }
@keyframes atBalanca { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.amesa.no-mouse .at-mesa { animation-play-state: paused; }

/* placas com espessura: a "lateral" é uma sombra sólida logo abaixo */
.jw {
  transform: translateZ(0); transform-origin: 50% 50%;
  box-shadow: 0 5px 0 -1px #0b1220, 0 5px 0 0 rgba(200, 214, 235, .14), 0 22px 30px -18px rgba(0, 0, 0, .9);
  transition: transform .7s cubic-bezier(.3, 1.45, .55, 1), opacity .45s var(--ease), border-color .4s, box-shadow .55s var(--ease);
}
.jw:has(.jw-luz.on:not(.fora)) {
  transform: translateZ(45px) rotateX(-5deg);
  box-shadow: 0 5px 0 -1px #0b1220, 0 5px 0 0 rgba(199, 243, 107, .5), 0 60px 60px -30px rgba(0, 0, 0, .85), 0 0 40px -6px rgba(181, 234, 76, .55);
}
.jw:has(.jw-ok.on) { transform: translateZ(14px); }

/* entrada: as telas descem do fundo, uma por vez, quando o painel aparece */
.js .auto-fluxo:not(.rodando) .jw { opacity: 0; transform: translateZ(-160px) translateY(30px); transition-duration: .3s; transition-delay: 0s; }
.js .auto-fluxo.rodando .jw:nth-child(1) { transition-delay: 0s; }
.js .auto-fluxo.rodando .jw:nth-child(2) { transition-delay: .08s; }
.js .auto-fluxo.rodando .jw:nth-child(3) { transition-delay: .16s; }
.js .auto-fluxo.rodando .jw:nth-child(4) { transition-delay: .24s; }
.js .auto-fluxo.rodando .jw:has(.jw-luz.on), .js .auto-fluxo.rodando .jw:has(.jw-ok.on) { transition-delay: 0s; }
.js .auto-fluxo:not(.rodando) .at-mesa { animation-play-state: paused; }

@media (max-width: 520px) {
  .amesa { transform: rotateX(8deg); }
  .at-topo { transform: translateZ(40px); }
  .jw:has(.jw-luz.on:not(.fora)) { transform: translateZ(50px) rotateX(-6deg) scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
  .at-mesa { animation: none; }
  .js .auto-fluxo:not(.rodando) .jw { opacity: 1; transform: translateZ(14px); }
  .js .amesa [data-s], .js .amesa [data-ate], .jw, .js .amesa .em-lista { transition: none !important; }
  .js .jw { opacity: 1; transform: translateZ(14px); }
  .js .amesa [data-s]:not(.at-toast) { opacity: 1 !important; transform: none !important; }
  .js .at-espera, .js .at-toast, .js .mb-anon, .js .zp-cinza, .js .mb-fechado, .jw-luz { opacity: 0 !important; }
  .mb-cad { color: #3ddc84; background: rgba(61, 220, 132, .14); }
  .js .rd-tempo b { opacity: 0 !important; }
  .js .rd-tempo b:last-child { opacity: 1 !important; transform: none !important; }
}
