/* ═══════════════════════════════════════════════════════════════════
   Casca Vercel — login, header com botões, telas de boot/erro.

   IMPORTANTE: as variaveis a seguir sao apenas DEFAULTS de fallback.
   O viewer.js sobrescreve TODAS elas via document.documentElement.style
   antes de mostrar qualquer tela, usando as cores publicadas em
   /clientes/<slug>.json. Assim a tela de login fica no MESMO tema do
   relatorio (sem "flash" claro/escuro).
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --primary: #a3e635;
  --primary-glow: rgba(163,230,53,.4);
  --bg: #0a0a0a;
  --card: #131313;
  --card-border: #1e1e1e;
  --text: #e0e0e0;
  --dim: #777777;
  --danger: #ef4444;
  --font: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
}

.hidden { display: none !important; }

/* ─────────────────────────── BOOT SCREEN ─────────────────────────── */
.boot-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 10000;
  transition: opacity .2s;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--card-border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────── LOGIN ─────────────────────────── */
.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 36px 28px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
}
.login-logo {
  max-width: 140px;
  max-height: 64px;
  width: auto;
  height: auto;
  margin: 0 auto 22px;
  object-fit: contain;
  display: block;
}
.login-logo[src=""], .login-logo:not([src]) { display: none; }
.login-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.3px;
  margin-bottom: 4px;
  color: var(--text);
}
.login-subtitle {
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 28px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 500;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  font-size: 11px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 500;
}
.field input {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 11px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
/* Botao Entrar: usa cor primaria como fundo. Texto contrastante calculado em JS. */
#login-submit {
  margin-top: 10px;
  background: var(--primary);
  color: var(--primary-contrast, #000);
  border: none;
  border-radius: 8px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .3px;
  cursor: pointer;
  transition: transform .1s, box-shadow .15s, filter .15s;
}
#login-submit:hover {
  box-shadow: 0 6px 20px var(--primary-glow);
  filter: brightness(1.05);
}
#login-submit:active { transform: scale(.98); }
#login-submit:disabled { opacity: .5; cursor: not-allowed; }

.login-error {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--danger-bg, rgba(239,68,68,.1));
  border: 1px solid var(--danger-border, rgba(239,68,68,.3));
  border-radius: 8px;
  color: var(--danger);
  font-size: 13px;
  text-align: center;
}

/* ─────────────────────────── VIEWER ─────────────────────────── */
.viewer-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.viewer-header {
  position: absolute;
  top: 5px;
  right: 14px;
  z-index: 100;
  display: flex;
  gap: 8px;
}
.viewer-header {
  position: absolute;
  top: 5px;
  right: 14px;
  z-index: 100;
  display: flex;
  gap: 8px;
}

@media (min-width: 1024px) {
  .viewer-header {
    top: 14px;
  }
}
.refresh-btn, .logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 7px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.refresh-btn:hover, .logout-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.refresh-btn:disabled { opacity: .6; cursor: not-allowed; }
.refresh-btn.loading svg { animation: spin 1s linear infinite; }
.logout-btn { padding: 7px 9px; }

.report-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--bg);
}

/* ─────────────────────────── TOAST ─────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0,0,0,.15);
  max-width: 90%;
  text-align: center;
  z-index: 200;
  animation: toast-in .2s ease-out;
}
.toast.success { border-left-color: var(--primary); }
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ─────────────────────────── 404 ─────────────────────────── */
.notfound {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  text-align: center;
}
.notfound h1 {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -2px;
  margin-bottom: 8px;
}
.notfound p {
  color: var(--dim);
  font-size: 14px;
  max-width: 320px;
  line-height: 1.5;
}
