/* Só o totem: tela em pé de 22" (1080×1920), só toque (docs/TOTEM.md do matrix-docs).
   Medidas em vh: em outra tela em pé, tudo fica na mesma proporção.

   ┌──────────────── cabeçalho ────────────────┐
   │                  ELIS                     │
   │      Iniciar · forma de pagamento         │  ← toda ação é aqui
   ├──────── máquinas ─────┬──── conversa ─────┤
   │ L1  L2  L3            │                   │
   │ S1  S2  S3            │   [campo]         │
   ├───────────────── teclado ─────────────────┤
   └───────────────────────────────────────────┘ */
:root {
  --fundo: #eef6f8; --painel: #fff; --texto: #12203a; --suave: #56657a; --linha: #d4e0e6;
  --marca: #006e85; --livre: #15703f; --uso: #9a5200; --parada: #b3261e;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--fundo); color: var(--texto); font: 2.1vw/1.35 system-ui, sans-serif;
  -webkit-user-select: none; user-select: none; touch-action: manipulation; overscroll-behavior: none;
}
@media (min-aspect-ratio: 9/14) { body { font-size: 1.18vh; } } /* tela deitada (teste no computador) */

header { display: flex; gap: 2vh; align-items: center; padding: .9vh 2vh; background: var(--texto); color: #fff; }
h1 { margin: 0; font-size: 1.4em; flex: 1; }
.aviso { font-size: .8em; color: #8ff4ff; }

main {
  flex: 1; min-height: 0; width: min(100%, 56.25vh); margin: 0 auto;
  display: grid; gap: 1vh; padding: 1vh;
  grid-template-columns: 1.25fr 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "atendente atendente" "maquinas conversa" "teclado teclado";
}
section { background: var(--painel); border: 1px solid var(--linha); border-radius: 1.4vh; padding: 1.4vh; min-width: 0; min-height: 0; }

button {
  font: inherit; min-height: 4.5vh; padding: .5vh 2vh; border-radius: 1.2vh; border: 2px solid var(--marca);
  background: #fff; color: var(--marca); cursor: pointer;
}
button.principal { background: var(--marca); color: #fff; font-weight: 600; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.discreto { min-height: 0; padding: .4vh 1.6vh; font-size: .8em; border-color: #8ff4ff; background: transparent; color: #fff; }
:focus-visible { outline: 4px solid #00a8c8; outline-offset: 2px; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* ---- Antes de iniciar: só a ELIS, grande, e o Iniciar logo abaixo ---- */
body.inicio main { grid-template-rows: minmax(0, 1fr); grid-template-areas: "atendente atendente"; }
body.inicio .maquinas, body.inicio .conversa, body.inicio .teclado { display: none; }
body.inicio .atendente { justify-content: center; gap: 2vh; }
body.inicio #elis { height: 62vh; }
body.inicio #iniciar, body.inicio #entrar { min-height: 10vh; font-size: 2.2em; }
.sugestoes { display: flex; gap: 1vh; }
/* O telefone para conferir: grande, como num visor. */
.telefone-conferir { border: 3px solid var(--marca); border-radius: 1.4vh; padding: 1vh 1.4vh; text-align: center; background: #e6f5f8; }
.telefone-conferir p { margin: 0; }
#telefone-aviso { font-weight: 600; color: var(--marca); }
#telefone-aviso.existe { color: var(--uso); }
/* Enquanto o número está na tela, a ELIS encolhe para caberem as máquinas e a conversa. */
body.conferindo #elis { height: 17vh; }
.telefone-conferir .numero { font-size: 3em; font-weight: 700; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.sugestoes button { flex: 1; min-height: 6.5vh; font-size: 1.35em; }

/* ---- ELIS ao centro e as ações logo abaixo ---- */
.atendente { grid-area: atendente; display: flex; flex-direction: column; align-items: center; gap: .8vh; padding: 1vh 1.4vh; }
/* ELIS em vídeo: a imagem de espera embaixo e os dois vídeos que se alternam por cima.
   O quadro mostra da cabeça até logo abaixo das mãos (o vídeo é 768×1344): recorta embaixo, nunca em cima. */
#elis { position: relative; height: 26vh; aspect-ratio: 768 / 1250; border-radius: 1.4vh; overflow: hidden; background: #a3b4c4; }
#elis img, #elis video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
#elis video { opacity: 0; transition: opacity .18s linear; }
#elis video.visivel { opacity: 1; }
/* Fora de operação: faixa vermelha atravessando a ELIS e a mensagem do dono no lugar do Iniciar. */
.faixa-fora { display: none; position: absolute; z-index: 5; left: -10%; right: -10%; top: 46%; padding: 1.4vh 0; transform: rotate(-8deg); background: #c8372d; color: #fff; text-align: center; font-size: 1.5em; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; box-shadow: 0 .6vh 2vh rgba(0, 0, 0, .35); }
body.fora .faixa-fora { display: block; }
body.fora #elis img, body.fora #elis video { filter: grayscale(.6); }
body.fora #iniciar, body.fora #entrar, body.fora .dica, body.inicio.fora #estado { display: none; }
.fora-mensagem { margin: 0; padding: 2vh 2vw; border: 3px solid #c8372d; border-radius: 1.4vh; background: #fdecea; color: #8c1d14; text-align: center; font-size: 1.5em; font-weight: 600; }
body.inicio .faixa-fora { font-size: 2.4em; }
#estado { margin: 0; text-align: center; color: var(--suave); min-height: 1.4em; }
.dica { margin: 0; padding: .5vh 1.6vh; border-radius: 99px; background: #e6f5f8; color: var(--texto); text-align: center; font-size: 1.05em; }
.dica b { color: var(--marca); }
body.inicio .dica { font-size: 1.3em; padding: .8vh 2.4vh; }
.acoes { width: 100%; display: flex; flex-direction: column; gap: 1vh; }
#iniciar, #entrar { min-height: 6.5vh; font-size: 1.6em; }
#encerrar { min-height: 4vh; }
.cartao { border: 3px solid var(--marca); border-radius: 1.4vh; padding: .8vh 1.2vh; display: flex; flex-wrap: wrap; gap: 1vh; align-items: center; }
.cartao p { margin: 0; flex-basis: 100%; text-align: center; font-weight: 600; font-size: 1.2em; }
.cartao .formas { flex: 3; display: flex; gap: 1vh; }
.cartao .formas button { flex: 1; min-height: 6.5vh; font-size: 1.35em; }
#agora-nao { flex: 1; min-height: 6.5vh; }

/* ---- Máquinas: cada lavadora com a secadora de mesmo número logo abaixo ---- */
.maquinas { grid-area: maquinas; display: flex; flex-direction: column; gap: 1vh; overflow: hidden; }
.grade { flex: 1; min-height: 0; display: grid; grid-template-rows: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .6vh; }
.maquina { min-height: 0; overflow: hidden; text-align: left; padding: .4vh .6vh; border-color: var(--linha); color: var(--texto); display: flex; flex-direction: column; justify-content: center; gap: .2vh; }
.maquina:disabled { opacity: 1; }
.maquina b, .maquina span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maquina b { font-weight: 600; font-size: .95em; }
.maquina span { font-size: .74em; font-variant-numeric: tabular-nums; }
.LIVRE .situacao { color: var(--livre); }
/* A ELIS pediu para escolher: as livres pulsam, para o cliente ver que pode tocar nelas. */
body.escolhendo .maquina.LIVRE:not(:disabled) { border: 3px solid var(--livre); animation: chamar 1.4s ease-in-out infinite; }
@keyframes chamar { 50% { box-shadow: 0 0 0 .6vh rgba(21, 112, 63, .25); } }
@media (prefers-reduced-motion: reduce) { body.escolhendo .maquina.LIVRE { animation: none; } }
#maquinas:not(:has(button)) { display: flex; align-items: center; justify-content: center; color: var(--suave); }
.EM_USO .situacao, .RESERVADA .situacao { color: var(--uso); }
.BLOQUEADA .situacao { color: var(--parada); }
.maquininha { display: flex; flex-direction: column; min-height: 0; padding: .8vh 1.4vh; border-radius: 1.2vh; background: var(--texto); color: #fff; }
.maquininha h2 { margin: 0; font-size: .85em; font-weight: 600; color: #8ff4ff; }
.maquininha h2::after { content: "  ➜ no suporte à direita da tela"; color: #fff; font-weight: 400; }
.maquininha.no-pix h2::after { content: ""; }
.maquininha p { margin: .3vh 0 0; font-size: 1.1em; }
/* Pix: o QR Code no lugar das máquinas, grande e num quadro claro (o leitor do banco precisa de contraste). */
body.pagando-pix .grade { display: none; }
body.pagando-pix .maquininha { flex: 1; }
body.pagando-pix details { display: none; }
.pix { flex: 1; min-height: 0; margin-top: .8vh; display: flex; flex-direction: column; align-items: center; gap: .8vh; text-align: center; }
.pix img { flex: 1 1 auto; min-height: 0; max-width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 1vh; padding: .6vh; image-rendering: pixelated; }
.pix p { margin: 0; font-size: .9em; }
details { display: none; font-size: .8em; }
body.simulacao details { display: block; }
summary { cursor: pointer; color: var(--suave); }
details label { display: flex; flex-direction: column; gap: .3vh; margin-top: .6vh; }
select { font: inherit; min-height: 4vh; border: 1px solid #8194a5; border-radius: 1vh; background: #fff; color: inherit; }
.erro { color: var(--parada); margin: .6vh 0 0; }

/* ---- Conversa: tudo o que foi falado e escrito ---- */
.conversa { grid-area: conversa; display: flex; flex-direction: column; gap: 1vh; }
#falas { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .8vh; }
#falas li { max-width: 88%; padding: .8vh 1.2vh; border-radius: 1.2vh; overflow-wrap: anywhere; }
#falas .agente { align-self: flex-start; background: #e6f5f8; }
#falas .cliente { align-self: flex-end; background: var(--marca); color: #fff; }
#falas .sistema { align-self: center; color: var(--suave); font-size: .85em; }
#texto { font: inherit; min-height: 4.2vh; padding: .5vh 1.2vh; border: 2px solid #8194a5; border-radius: 1.2vh; background: #fff; color: inherit; width: 100%; }

/* ---- Teclado na tela, sempre aberto ---- */
.teclado { grid-area: teclado; display: flex; flex-direction: column; gap: .5vh; padding: .8vh; }
.teclado.inativo { opacity: .5; }
.fileira { display: flex; gap: .5vh; }
.tecla { flex: 1; min-width: 0; min-height: 4.2vh; padding: 0; font-size: 1.15em; border-color: var(--linha); color: var(--texto); }
.tecla:active:not(:disabled) { background: #d6eef3; }
.tecla:disabled { opacity: 1; cursor: default; }
.tecla-apagar { flex: 2; font-size: .95em; }
.tecla-espaco { flex: 6; }
.tecla-enviar { flex: 3; background: var(--marca); color: #fff; font-weight: 600; border-color: var(--marca); }
/* Dois modos: letras ou só os números (o telefone), grandes, como um teclado de telefone. */
.modo { display: flex; flex-direction: column; gap: .5vh; }
.teclado .modo-numeros, .teclado.numeros .modo-letras { display: none; }
.teclado.numeros .modo-numeros { display: flex; width: min(100%, 60vh); margin: 0 auto; }
.modo-numeros .tecla { font-size: 1.6em; font-weight: 600; }
.modo-numeros .tecla-apagar, .modo-numeros .tecla-letras { flex: 1; font-size: 1em; font-weight: 400; }
