/* Espelho PDV - base comum da grade e do painel.
   Direcao: sala de monitoramento. Fundo azul-petroleo escuro, imagem em primeiro plano,
   cantos de "visor de camera" nas molduras e uma luz de sinal (verde = ao vivo). */

:root {
  color-scheme: dark;
  --fundo: #0b171c;
  --painel: #11222a;
  --moldura: #1d3640;
  --linha: #2a4753;
  --texto: #e7f0f2;
  --fraco: #9bb1b8;
  --apagado: #647f89;
  --sinal: #3fd68b;
  --sobre-sinal: #05230f;
  --espera: #e9b44c;
  --alerta: #ff8a7d;
  --foco: #8fd3ff;
  --raio: 6px;
  --fonte: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2, h3, p { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--foco);
  outline-offset: 2px;
}

/* ---------- barra de cima ---------- */

.topo {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  min-height: 56px;
  padding: 8px 16px;
  background: var(--fundo);
  border-bottom: 1px solid var(--moldura);
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--texto);
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.marca img { display: block; width: 28px; height: 28px; }

.topo-grade {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-left: auto;
}

/* ---------- botoes ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 44px;
  padding: 0.55em 1.25em;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: transparent;
  color: var(--texto);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover { background: rgba(255, 255, 255, 0.07); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-principal {
  background: var(--sinal);
  border-color: var(--sinal);
  color: var(--sobre-sinal);
}
.btn-principal:hover { background: #5be3a2; }

.btn-perigo {
  border-color: #8a4a45;
  color: var(--alerta);
}
.btn-perigo:hover { background: rgba(255, 138, 125, 0.12); }

.btn-perigo-cheio {
  background: var(--alerta);
  border-color: var(--alerta);
  color: #2a0a07;
}
.btn-perigo-cheio:hover { background: #ffa095; }

.btn-pequeno { min-height: 38px; padding: 0.35em 1em; font-size: 0.9rem; }
.btn-grande { min-height: 52px; padding: 0.7em 1.8em; font-size: 1.05rem; }

.link-fraco {
  display: inline-flex;
  align-items: center;
  padding: 0.35em 0.2em;
  color: var(--fraco);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.link-fraco:hover { color: var(--texto); }

/* Alvo de toque de pelo menos 44x44 px em tela de toque. */
@media (pointer: coarse) {
  .btn, .btn-pequeno, .link-fraco, .marca, .alvo {
    position: relative;
    min-height: 44px;
    min-width: 44px;
  }
  .link-fraco::after, .alvo-link::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: max(100%, 44px);
    height: max(100%, 44px);
    transform: translate(-50%, -50%);
  }
}

/* ---------- formularios ---------- */

.campo { display: grid; gap: 6px; margin-top: 18px; }
.campo label { font-weight: 600; }

.campo input {
  width: 100%;
  min-height: 48px;
  padding: 0.65em 0.85em;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: var(--fundo);
  color: var(--texto);
  font: inherit;
  font-size: 1rem;
}
.campo input::placeholder { color: var(--apagado); }
.campo input:focus { border-color: var(--foco); outline: none; box-shadow: 0 0 0 3px rgba(143, 211, 255, 0.28); }

.erro {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--alerta);
  background: rgba(255, 138, 125, 0.1);
  color: #ffc2bb;
}

.formulario-acoes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

/* ---------- telas de acesso (pedir acesso, login, trocar senha) ---------- */

.acesso {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px 16px 48px;
}

.acesso-caixa {
  position: relative;
  width: min(100%, 460px);
  padding: 36px 32px 30px;
  background: var(--painel);
  border: 1px solid var(--moldura);
  border-radius: var(--raio);
}

.acesso-caixa h1 { font-size: 1.45rem; line-height: 1.25; font-weight: 650; }
.acesso-caixa p { margin-top: 12px; color: var(--fraco); }
.acesso-caixa .campo + .erro, .acesso-caixa form .erro { margin-top: 14px; }
.acesso-caixa .formulario-acoes .btn { flex: 1 1 auto; }
.acesso-rodape { margin-top: 22px !important; font-size: 0.9rem; }

/* Cantos de visor de camera: usados nas molduras do app. A cor vem de --estado. */
.cantos {
  --c: var(--estado, var(--apagado));
  --e: 2px;
  --t: 16px;
  position: absolute;
  inset: 5px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--e) no-repeat,
    linear-gradient(var(--c), var(--c)) top left / var(--e) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--e) no-repeat,
    linear-gradient(var(--c), var(--c)) top right / var(--e) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--e) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / var(--e) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--e) no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / var(--e) var(--t) no-repeat;
}

.acesso-caixa { --estado: var(--sinal); }

/* ---------- luz de sinal ---------- */

.tally {
  display: inline-block;
  flex: none;
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--estado, var(--apagado));
}

@keyframes pulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 214, 139, 0.55); }
  60% { box-shadow: 0 0 0 0.45em rgba(63, 214, 139, 0); }
}

/* ---------- dialogos proprios ---------- */

.dialogo {
  width: min(92vw, 460px);
  padding: 28px 28px 24px;
  border: 1px solid var(--linha);
  border-radius: var(--raio);
  background: var(--painel);
  color: var(--texto);
}
.dialogo::backdrop { background: rgba(2, 8, 10, 0.8); }
.dialogo h2 { font-size: 1.25rem; line-height: 1.3; }
.dialogo p { margin-top: 12px; color: var(--fraco); }
.dialogo .formulario-acoes .btn { flex: 1 1 auto; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
