/* =========================================================
   Iris — tela de login
   Mesma linguagem visual do app (herdada do front-end da Helix): cartão
   chapado, régua de 1px, tipografia monoespaçada nos metadados.
   Cores em tokens.css — a paleta verde da Iris.
   ========================================================= */

html, body { min-height: 100%; }

.login-page {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; position: relative;
}

/* Malha discreta ao fundo. Único elemento decorativo da página. */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px; opacity: 0.28;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black, transparent);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, black, transparent);
}

/* ── Controles flutuantes ── */
.floating-controls { position: fixed; top: 22px; right: 22px; display: flex; gap: 6px; z-index: 5; }
.ctrl-btn {
  height: 34px; min-width: 34px; padding: 0 9px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 4px;
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.ctrl-btn:hover { color: var(--ink-3); border-color: var(--muted-2); }
.ctrl-btn.active,
.ctrl-btn[aria-pressed="true"] {
  color: var(--accent-ink); border-color: var(--accent); background: var(--accent-tint);
}

/* ── Cartão ── */
.login-card {
  position: relative; width: 100%; max-width: 430px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; box-shadow: var(--shadow);
  animation: fadeUp 0.5s ease both;
}
.card-accent { height: 2px; background: var(--accent); }
.card-body { padding: 44px 44px 28px; display: flex; flex-direction: column; align-items: center; }

/* O círculo é feito aqui, não queimado no arquivo: o navegador desenha a borda
   na resolução do dispositivo e não sobra franja na redução. */
.login-logo {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 50%; margin-bottom: 18px; background: var(--surface-2);
}
.login-title { font-size: 30px; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.login-sub { margin-top: 8px; font-size: 13px; color: var(--muted); }
.rule { width: 100%; height: 1px; background: var(--line); margin: 28px 0 24px; }

.info-line {
  font-size: 13px; line-height: 1.6; color: var(--ink-3);
  text-align: center; margin-bottom: 22px; text-wrap: pretty;
}
.info-line strong { font-weight: 600; color: var(--ink-2); }

#loginSection { width: 100%; }
.ms-btn {
  width: 100%; padding: 14px 20px;
  border: 1px solid var(--accent); background: transparent; color: var(--ink-3);
  border-radius: 4px; font-size: 15px; font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer; transition: background 0.18s, border-color 0.18s;
}
.ms-btn:hover { background: var(--accent-tint); }
.ms-btn:active { background: var(--accent-tint-2); }
.ms-btn:disabled { opacity: 0.45; cursor: default; }
.ms-btn svg { flex-shrink: 0; color: var(--accent); }

/* ── Carregando ──
   login.js alterna a classe .visible (e não .hidden) nesta seção. */
#loadingSection { display: none; width: 100%; margin-top: 18px; }
#loadingSection.visible { display: block; }
.loading-line {
  display: flex; align-items: center; gap: 9px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px; color: var(--muted);
}
.spinner {
  width: 12px; height: 12px; border: 1.5px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  display: inline-block; flex-shrink: 0; animation: spin 0.8s linear infinite;
}
.loading-track {
  margin-top: 10px; height: 2px; background: var(--line-soft);
  border-radius: 2px; overflow: hidden;
}
.loading-fill { height: 100%; width: 34%; background: var(--accent); animation: sweep 1.2s ease-in-out infinite; }

/* ── Erro ── */
#errorMessage {
  width: 100%; margin-top: 18px; padding-left: 14px;
  border-left: 2px solid var(--danger);
  display: flex; flex-direction: column; gap: 6px;
  animation: fadeUp 0.3s ease both;
}
.error-kicker {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--danger-ink);
}
#errorText { font-size: 13px; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }
/* Detalhe técnico do MSAL: útil no suporte, secundário para o usuário. */
.error-detail {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11px; line-height: 1.5;
  color: var(--muted-2); word-break: break-word;
}

.card-footer {
  border-top: 1px solid var(--line-soft); padding: 14px 44px;
  display: flex; justify-content: space-between; gap: 12px;
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 11px;
  color: var(--muted-2); letter-spacing: 0.02em;
}

@media (max-width: 480px) {
  .card-body { padding: 36px 26px 24px; }
  .card-footer { padding: 14px 26px; }
  .floating-controls { top: 14px; right: 14px; }
}
