/* ── Tela de autenticação ─────────────────────────────────────── */

dialog.auth-overlay {
  border: none;
  padding: 20px;
  margin: auto;
  background: var(--bg);
  width: 100%;
  max-width: 100vw;
  max-height: 100dvh;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

dialog.auth-overlay[open] { display: flex; }

dialog.auth-overlay::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

/* ── Card ────────────────────────────────────────────────────── */
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--s1);
  border: 1px solid var(--bdr2);
  border-radius: 24px;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}

/* ── Overlay de loading sobre o card ─────────────────────────── */
.auth-load-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--s1) 96%, transparent);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.auth-load-overlay.on {
  opacity: 1;
  pointer-events: all;
}

.auth-load-ring {
  width: 52px;
  height: 52px;
  border: 3.5px solid var(--bdr2);
  border-top-color: var(--purple);
  border-radius: 50%;
  animation: authSpin 0.72s linear infinite;
}

@keyframes authSpin {
  to { transform: rotate(360deg); }
}

.auth-load-msg {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--txt);
  letter-spacing: -0.2px;
}

.auth-load-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: -6px;
}

/* ── Logo ────────────────────────────────────────────────────── */
.auth-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.5px;
  color: var(--txt);
}

/* ── Tabs ────────────────────────────────────────────────────── */
.auth-tabs {
  display: flex;
  background: var(--s2);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.auth-tab.on {
  background: var(--s1);
  color: var(--txt);
  box-shadow: 0 1px 6px rgba(0,0,0,0.18);
}

/* ── Formulário ──────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Campo com ícone ─────────────────────────────────────────── */
.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
  letter-spacing: 0.3px;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-icon {
  position: absolute;
  left: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  pointer-events: none;
  flex-shrink: 0;
}

.auth-input-wrap .finput {
  padding-left: 42px;
  width: 100%;
  background: var(--s2);
  border-color: var(--bdr2);
  font-size: 15px;
}

.auth-input-wrap .finput:focus { border-color: var(--purple); }
.auth-input-wrap .finput:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon { color: var(--purple); }

/* Quando é campo de senha (com olho) */
.auth-input-wrap .finput.has-eye { padding-right: 46px; }

/* ── Botão de submit ─────────────────────────────────────────── */
.btn-ok {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-ok:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Senha com olho ──────────────────────────────────────────── */
.pass-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pass-wrap .finput {
  width: 100%;
  padding-right: 44px;
}

.pass-eye {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  border-radius: 6px;
}

.pass-eye:hover { color: var(--txt); }

/* ── Logo cadastro ───────────────────────────────────────────── */
.auth-register-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
}

.auth-register-nome {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: var(--txt);
  letter-spacing: -0.3px;
}

/* ── Hint (link) ─────────────────────────────────────────────── */
.auth-hint {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.auth-hint a {
  color: var(--purple);
  text-decoration: none;
  font-weight: 600;
}

.auth-hint a:hover { text-decoration: underline; }

/* ── Inline error ────────────────────────────────────────────── */
.auth-error {
  display: none;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--red-bg);
  border: 1px solid var(--red-d);
  color: var(--red);
  font-size: 13px;
  line-height: 1.5;
}

.auth-error.on { display: block; }

/* ── Dev mode badge (só visível em ambiente de desenvolvimento) ── */
.dev-token-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  border-radius: 10px;
  background: rgba(251, 191, 36, 0.10);
  border: 1px solid rgba(251, 191, 36, 0.30);
  color: var(--amber);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

/* ── Logout btn ──────────────────────────────────────────────── */
.logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.2s;
}

.logout-btn:hover { background: var(--s2); }
