/* Telas de autenticação do IAM.
   Split-screen: painel de marca escuro (logo, ilustração, chamada) à esquerda e
   formulário sobre fundo claro à direita. Autocontido: fontes, ilustração e
   ícones são servidos pelo próprio IAM — nenhuma requisição externa. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/static/inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/static/space-grotesk.woff2') format('woff2');
}

:root {
  color-scheme: light;

  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --ink: #0A0A0A;
  --muted: #6B6B6B;
  --subtle: #737373;
  --faint: #8A8A8A;
  --border: #E5E5E0;
  --divider: #EAEAE5;

  /* Destaque — amarelo. Texto sobre ele é SEMPRE --ink. */
  --accent: #FACC15;
  --accent-hover: #EAB308;
  --accent-deep: #CA8A04;
  --accent-ink: #A16207;
  --accent-soft: #FEF9C3;
  --accent-soft-border: #FDE68A;

  /* Painel de marca */
  --chrome: #0A0A0A;
  --chrome-ink: #FAFAFA;
  --chrome-muted: #A3A3A3;

  --danger-text: #B42318;
  --danger-soft: #FEF3F2;
  --danger-border: #FECDCA;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-sans);
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;

  --r-control: 12px;
  --r-tile: 14px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 150ms;
}

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

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible { outline: 2px solid var(--accent-deep); outline-offset: 3px; border-radius: 4px; }

/* ── Split-screen ──────────────────────────────────────────────────── */

.auth-screen {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: clamp(400px, 39vw, 560px) 1fr;
  background: var(--bg);
}

/* Painel de marca (esquerda) */
.auth-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 56px;
  background: var(--chrome);
  overflow: hidden;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1;
  color: var(--chrome-ink);
}
.auth-logo__mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--ink);
  font-size: 20px;
  letter-spacing: 0;
}

.auth-art {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}
.auth-art img {
  display: block;
  width: min(400px, 100%);
  height: auto;
}

.auth-hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 460px;
}
.auth-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}
.auth-headline {
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.02;
  text-wrap: balance;
  color: var(--chrome-ink);
}
.auth-subcopy {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
  color: var(--chrome-muted);
}

/* Painel de formulário (direita) */
.auth-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Bloco de ícone no topo de cada tela */
.auth-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--r-tile);
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-border);
  color: var(--accent-ink);
}
.auth-icon svg { width: 24px; height: 24px; }
.auth-icon--danger {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger-text);
}

.auth-titles { display: flex; flex-direction: column; gap: 10px; }

.auth-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1.15;
  text-wrap: balance;
  color: var(--ink);
}

.auth-subtitle {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}
.auth-subtitle strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }

.auth-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-control);
  background: var(--danger-soft);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
  font-size: 14px;
}
.auth-error svg { flex-shrink: 0; margin-top: 2px; }

.auth-form { display: flex; flex-direction: column; gap: 20px; }

/* ── Controles ─────────────────────────────────────────────────────── */

.c-field { display: flex; flex-direction: column; gap: 8px; }
.c-field__label { font-size: 14px; font-weight: 500; color: var(--ink); }
.c-field__hint { margin: 0; font-size: 13px; color: var(--faint); }
/* O botão fica um pouco mais afastado do último campo que os campos entre si. */
.c-field + .c-btn { margin-top: 8px; }
/* Rótulo só para leitores de tela (o título da tela já diz o que digitar). */
.c-field__label--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.c-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.c-input:hover { border-color: #D4D4D4; }
.c-input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Código de 6 dígitos sem JavaScript: um campo só, largo e espaçado. */
.c-input--otp {
  height: 64px;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0.4em;
  text-align: center;
}

/* Código de 6 dígitos com JavaScript (otp.js): uma caixa por dígito. */
.otp-boxes { display: flex; align-items: center; gap: 10px; }
.otp-digit {
  flex: 1;
  min-width: 0;
  height: 64px;
  padding: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  caret-color: var(--accent-deep);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.otp-digit:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.otp-dash { flex: none; width: 10px; height: 2px; background: #D4D4D4; }

.c-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 54px;
  padding: 0 24px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  border: 0;
  border-radius: var(--r-control);
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.c-btn svg { width: 18px; height: 18px; }
.c-btn:active { transform: scale(0.985); }
.c-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.c-btn--primary { background: var(--accent); color: var(--ink); }
.c-btn--primary:hover { background: var(--accent-hover); text-decoration: none; }

.c-btn--block { width: 100%; }

/* Linha de links sob o formulário: principal à esquerda, secundário à direita. */
.auth-links {
  margin: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.auth-links a { font-weight: 500; }
.auth-links a.is-quiet { font-weight: 400; color: var(--subtle); }

.auth-note { margin: 0; font-size: 14px; color: var(--muted); }

/* Rodapé de confiança */
.auth-foot {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 28px;
  border-top: 1px solid var(--divider);
  font-size: 13px;
  color: var(--faint);
}
.auth-foot svg { width: 14px; height: 14px; flex: none; }

/* ── Enrollment: QR + segredo + códigos de backup ──────────────────── */

.auth-enroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-tile);
  text-align: center;
}

.auth-qr { width: 200px; height: 200px; }

.auth-secret {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--divider);
  padding: 8px 12px;
  border-radius: 8px;
  word-break: break-all;
}

.auth-codes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-codes li {
  padding: 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
}
.auth-codes code {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--ink);
}

/* ── Telas estreitas: o painel vira uma faixa só com o logo ─────────── */

@media (max-width: 899px) {
  .auth-screen { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-panel { padding: 18px 24px; }
  .auth-art, .auth-hero { display: none; }
  .auth-main { align-items: flex-start; padding: 40px 24px 48px; }
  .auth-title { font-size: 28px; }
}

@media (max-width: 380px) {
  .otp-boxes { gap: 6px; }
  .otp-digit { height: 56px; font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .c-btn, .c-input, .otp-digit { transition: none; }
}
