/* Pagine di accesso (login, reset password, 2FA, passkey, consenso, registrazione, assistenti).
   Usano solo i token di tokens.css e vivono sotto `<html data-z1-theme="dark">`: superficie
   #1f1e1d, card #262523 con bordo 1 px, CTA brand, focus ring brand, errori in rosso di sistema.
   Niente gradienti, niente immagini di sfondo. */
html, body { margin: 0; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: rgb(var(--c-bg));
  color: rgb(var(--c-ink));
  font-size: var(--text-body);
  line-height: 1.5;
}

/* Zona centrale: la card sta al centro, il pie' di pagina in fondo, nel flusso (mai sopra la card). */
.auth-main {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px;
}
.wrap { width: 100%; max-width: 420px; min-width: 0; }

/* Marchio: "01" brand + nome in system-ui 600. Nessun fondo, nessuna placca. */
.topbar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.brand-mark { display: block; width: 36px; height: 36px; }
.brand-logo { display: block; width: auto; height: auto; max-width: 240px; max-height: 44px; object-fit: contain; }
.brand-name { font-size: 20px; font-weight: var(--weight-strong); letter-spacing: -.01em; color: rgb(var(--c-ink)); line-height: 1; }

.card { padding: 1.75rem; }

h1 { font-size: var(--text-title); font-weight: var(--weight-strong); line-height: 1.25; letter-spacing: -.01em; margin: 0 0 8px; text-wrap: balance; overflow-wrap: anywhere; }
h2 { font-size: 16px; font-weight: var(--weight-strong); line-height: 1.4; }
.sub { color: rgb(var(--c-muted)); font-size: var(--text-body); line-height: 1.5; margin: 0 0 24px; max-width: 46ch; text-wrap: pretty; }

/* Destinazione ("Stai accedendo a ..."): riga di contesto, non un riquadro tratteggiato. */
.target {
  display: flex; align-items: center; gap: 8px;
  background: rgb(var(--n-50));
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--r-control);
  padding: 8px 12px; margin: 0 0 20px;
  color: rgb(var(--c-ink)); font-size: var(--text-small); line-height: 1.4;
}
.target svg { flex: none; color: rgb(var(--c-muted)); }
.target a { color: rgb(var(--c-ink)); font-weight: var(--weight-strong); overflow-wrap: anywhere; }

label { display: block; font-size: var(--text-small); font-weight: var(--weight-strong); color: rgb(var(--c-ink)); margin-bottom: 6px; }

input[type=text], input[type=password], input[type=email], input[type=search], input[type=url], input[type=number] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid rgb(var(--c-line-strong));
  border-radius: var(--r-control);
  background: rgb(var(--c-field));
  color: rgb(var(--c-ink));
  font-family: inherit; font-size: 16px; line-height: 1.4; /* 16 px: iOS non zooma il campo */
  transition: border-color var(--dur-fast) ease;
}
input::placeholder { color: rgb(var(--c-muted)); opacity: .85; }
input:focus-visible { border-color: rgb(var(--c-ring)); }
input:disabled { opacity: .55; cursor: not-allowed; }
input[aria-invalid="true"] { border-color: var(--danger); }

/* Bottone di default delle pagine di accesso = CTA primaria (brand, testo scuro leggibile). */
button, .btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: rgb(var(--c-brand));
  color: rgb(var(--c-on-brand));
  font-family: inherit; font-size: var(--text-lg, 16px); font-weight: var(--weight-strong); line-height: 1.4;
  cursor: pointer; text-decoration: none;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease, transform 160ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  button:not(:disabled):hover, .btn:not(.btn--standard):not(.btn--ghost):not(.btn--danger):not(.btn--danger-solid):hover { background: rgb(var(--c-brand-hover)); color: rgb(var(--c-on-brand-hover)); }
}
button:disabled { opacity: .5; cursor: not-allowed; }
@media (prefers-reduced-motion: no-preference) { button:not(:disabled):active, .btn:active { transform: scale(.97); } }

/* Azione secondaria (Nega, "Continua senza passkey"): stessa forma, bordo al posto del riempimento. */
button.ghost, .btn-ghost, .btn.btn--standard, .btn.btn--ghost {
  background: transparent; color: rgb(var(--c-ink));
  border-color: rgb(var(--c-line-strong));
}
@media (hover: hover) and (pointer: fine) {
  button.ghost:not(:disabled):hover, .btn-ghost:hover, .btn.btn--standard:hover, .btn.btn--ghost:hover { background: rgb(var(--n-100)); color: rgb(var(--c-ink)); }
}
/* Rosso come nel riferimento: contorno con testo #ff6b70, oppure pieno con testo scuro (mai bianco su rosso). */
.btn.btn--danger { background: transparent; color: var(--danger-text); border-color: rgb(var(--c-line)); }
.btn.btn--danger-solid { background: var(--danger-text); border-color: var(--danger-text); color: var(--z1-on-light); }
@media (hover: hover) and (pointer: fine) {
  .btn.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger-text); }
  .btn.btn--danger-solid:hover { background: var(--danger); border-color: var(--danger); color: var(--z1-on-light); }
}

a { color: rgb(var(--c-ink)); text-decoration-color: rgb(var(--c-ring)); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--dur-fast) ease; }
@media (hover: hover) and (pointer: fine) { a:hover { color: rgb(var(--c-ring)); } }
a.btn, a.btn:hover { text-decoration: none; }

/* Codice OTP: sei celle collegate a un campo nascosto */
.otp-row { display: flex; gap: 8px; margin-bottom: 16px; }
.otp-box {
  width: 100%; min-width: 0; aspect-ratio: 1; max-height: 56px;
  margin: 0; padding: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px; font-weight: var(--weight-strong);
  border: 1px solid rgb(var(--c-line-strong));
  border-radius: var(--r-control);
  background: rgb(var(--c-field)); color: rgb(var(--c-ink));
}
.otp-box:focus-visible { border-color: rgb(var(--c-ring)); }

.recovery-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: rgb(var(--c-field));
  border: 1px solid rgb(var(--c-line));
  border-radius: var(--r-control);
  padding: 10px 12px; margin-top: 6px;
}
.recovery-box code { font-family: var(--font-mono); font-size: var(--text-small); letter-spacing: .03em; word-break: break-all; }

.copy-btn {
  width: auto; min-height: 32px; padding: 4px 12px;
  font-size: var(--text-label); font-weight: var(--weight-strong);
  background: transparent; color: rgb(var(--c-ink));
  border-color: rgb(var(--c-line-strong));
}
@media (hover: hover) and (pointer: fine) { .copy-btn:not(:disabled):hover { background: rgb(var(--n-100)); color: rgb(var(--c-ink)); } }

.steps { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: var(--text-body); color: rgb(var(--c-muted)); line-height: 1.5; }
.steps .n {
  flex: none; width: 24px; height: 24px;
  border-radius: var(--r-pill);
  background: rgb(var(--c-field)); border: 1px solid rgb(var(--c-line-strong)); color: rgb(var(--c-ink));
  font-size: var(--text-label); font-weight: var(--weight-strong);
  display: flex; align-items: center; justify-content: center;
}

/* Il QR resta su fondo bianco: serve contrasto pieno per essere letto dalla fotocamera. */
.qr-frame {
  background: #fff;
  border-radius: var(--r-card);
  padding: 12px;
  width: fit-content;
  margin: 0 auto 24px;
}
.qr-frame img { display: block; width: 176px; height: 176px; }

/* Pie' di pagina delle pagine di accesso: nel flusso, discreto, mai sovrapposto alla card. */
body > .z1-footer {
  position: static;
  background: transparent; backdrop-filter: none;
  padding: 16px 24px 20px;
  border-top: 1px solid rgb(var(--c-line));
}
body > .z1-footer .z1-footer-inner { max-width: 960px; margin: 0 auto; }

@media (max-width: 480px) {
  .auth-main { align-items: flex-start; padding: 24px 16px; }
  .card { padding: 1.25rem; }
  h1 { font-size: 20px; }
  .otp-row { gap: 6px; }
  body > .z1-footer { padding: 16px; }
}
