/* ═══════════════════════════════════════════════════════════════
   WScan Login — Production CSS
   Server-rendered, zero dependencies (plain CSS, no JS required)
   Font prerequisite — add to <head>:
   <link href="https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
   ═══════════════════════════════════════════════════════════════ */

/* ── 0. Box-model reset ─────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── 1. Design tokens ───────────────────────────────────────── */
:root {
  /* Ink */
  --ink:           #0d0c22;
  --ink-2:         #6e6d7a;
  --ink-muted:     #9e9ea7;

  /* Brand — MICRO-ACCENT ONLY (dot/mark), never on buttons or large surfaces */
  --brand:         #ea4c89;
  --brand-soft:    #fde7ef;

  /* Surfaces */
  --surface:       #ffffff;
  --surface-alt:   #f3f3f4;
  --surface-2:     #fafafb;

  /* Borders */
  --border:        #e7e7e9;
  --border-strong: #d8d8db;

  /* Status */
  --danger:        #c4321f;
  --danger-soft:   #fde7e3;
  --success:       #1f9d6b;

  /* Typography */
  --font-sans: "Inter Tight", "Inter", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  /* Radius */
  --radius-card: 12px;
  --radius-btn:  8px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(13,12,34,.06), 0 8px 24px rgba(13,12,34,.06);
  --shadow-sm:   0 1px 2px rgba(13,12,34,.04), 0 1px 1px rgba(13,12,34,.03);
}

/* ── 2. Page shell ──────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  padding: 24px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}

/* ── 3. Card ────────────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 32px;
}

/* ── 4. Logo lockup ─────────────────────────────────────────── */
.login-logo {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 28px;
}

.login-logo__dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--brand);   /* sole use of --brand */
  flex-shrink: 0;
  margin-top: 0.5px;          /* optical baseline correction */
}

.login-logo__wordmark {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1;
}

/* ── 5. Header ──────────────────────────────────────────────── */
.login-header {
  margin-bottom: 24px;
}

.login-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* ── 6. Error block ─────────────────────────────────────────── */
.login-error {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-btn);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 500;
  margin-bottom: 20px;
}

/* Add .is-visible to show (e.g. on ModelState error in Razor) */
.login-error.is-visible {
  display: block;
}

/* ── 7. Form ────────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── 8. Field wrapper ───────────────────────────────────────── */
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.login-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ── 9. Input ───────────────────────────────────────────────── */
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface-alt);
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
  font-variant-numeric: tabular-nums;
}

.login-input::placeholder {
  color: var(--ink-muted);
  font-weight: 400;
}

.login-input:hover:not(:focus):not(.is-invalid) {
  border-color: var(--border-strong);
}

.login-input:focus {
  background: var(--surface);
  border-color: var(--border-strong);
  outline: 2px solid var(--ink);   /* rule 3: focus ring nero */
  outline-offset: 2px;
}

/* Invalid state — driven by .is-invalid class (set server-side or via JS) */
.login-input.is-invalid {
  border-color: var(--danger);
  background: var(--surface);
}

.login-input.is-invalid:focus {
  outline-color: var(--danger);
}

/* Input inside .login-input-wrap: extra right padding for toggle button */
.login-input-wrap > .login-input {
  padding-right: 44px;
}

/* ── 10. Password visibility toggle (optional) ──────────────── */
.login-input-action {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0 var(--radius-btn) var(--radius-btn) 0;
  cursor: pointer;
  color: var(--ink-muted);
  transition: background 0.1s ease, color 0.1s ease;
  padding: 0;
}

.login-input-action:hover {
  background: var(--surface-alt);  /* rule 7: hover ghost → --surface-alt */
  color: var(--ink-2);
}

.login-input-action:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: var(--radius-btn);
}

.login-input-action:active {
  background: var(--border);
}

/* ── 11. Remember-me row ────────────────────────────────────── */
.login-row {
  display: flex;
  align-items: center;
}

.login-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.login-check__input {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  accent-color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
}

.login-check__label {
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 400;
}

/* ── 12. Primary CTA ────────────────────────────────────────── */
/* rule 1: SFONDO --ink, testo bianco. MAI pink. */
.login-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  background: var(--ink);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  outline: none;
  transition: background 0.12s ease;
  margin-top: 4px;
}

.login-btn:hover {
  background: #07061a;   /* leggermente più scuro di --ink */
}

.login-btn:active {
  background: #040311;
}

/* rule 3: focus ring nero */
.login-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.login-btn:disabled,
.login-btn.is-loading {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading inner text fades out; spinner appears */
.login-btn__text {
  transition: opacity 0.12s;
}

.login-btn.is-loading .login-btn__text {
  opacity: 0;
}

.login-btn__spinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.login-btn.is-loading .login-btn__spinner {
  display: flex;
}

.login-btn__spinner::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: var(--radius-pill);
  animation: wscan-spin 0.65s linear infinite;
}

@keyframes wscan-spin {
  to { transform: rotate(360deg); }
}

/* ── 13. Responsive ─────────────────────────────────────────── */
@media (max-width: 480px) {
  .login-card {
    padding: 24px 20px;
  }

  .login-title {
    font-size: 18px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   AUTH FLOW EXTENSION — Password Recovery Pages
   Extends wscan-login.css — do NOT modify existing .login-* blocks
   Routes: /Account/ForgotPassword · /Account/ResetPassword
   ═══════════════════════════════════════════════════════════════ */

/* ── A. New status tokens ────────────────────────────────────── */
:root {
  --warn:         #d97706;
  --warn-soft:    #fef3c7;
  --success-soft: #d1fae5;
}

/* ── B. Ghost / secondary button ────────────────────────────── */
/* Shared across ForgotPassword and ResetPassword pages.
   Works on both <button> and <a> elements.                      */
.login-btn-ghost {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 44px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  outline: none;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.login-btn-ghost:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.login-btn-ghost:active { background: var(--border); }

.login-btn-ghost:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}


/* ════════════════════════════════════════════════════════════════
   PAGINA A — Password dimenticata  (.forgot-*)
   HTML: <main class="login-card forgot-card">
   ════════════════════════════════════════════════════════════════ */

/* Back link: ← Torna al login */
.forgot-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  margin-bottom: 20px;
  letter-spacing: -0.01em;
  transition: color 0.12s ease;
}

.forgot-back:hover {
  color: var(--ink);
  text-decoration: underline;
}

.forgot-back:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Error banner — lives inside .forgot-form (between header and email field).
   Spacing is handled by the parent flex gap; no extra margin needed. */
.forgot-error {
  display: none;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-btn);
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

/* Form wrapper — flex column, title/subtitle live inside as first child */
.forgot-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Success state block */
.forgot-success {
  display: none;
  flex-direction: column;
}

/* Mail icon chip — 40×40, flat --surface-alt bg */
.forgot-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  background: var(--surface-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--ink-2);
  flex-shrink: 0;
}

/* ── State rules (class applied server-side by Razor Page) ───── */
.forgot-card.is-error   .forgot-error   { display: block; }
.forgot-card.is-success .forgot-form    { display: none; }
.forgot-card.is-success .forgot-success { display: flex; }


/* ════════════════════════════════════════════════════════════════
   PAGINA B — Reimposta password  (.reset-*)
   HTML: <main class="login-card reset-card">
   ════════════════════════════════════════════════════════════════ */

/* Form wrapper — flex column, title/subtitle live inside as first child */
.reset-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Field-level validation error (passwords mismatch) */
.reset-field-error {
  display: none;
  font-size: 13px;
  color: var(--danger);
  line-height: 1.4;
  margin-top: 2px;
}

/* Expired token state block */
.reset-expired {
  display: none;
  flex-direction: column;
}

/* Success state block */
.reset-success {
  display: none;
  flex-direction: column;
}

/* Icon chip — warn (expired token) */
.reset-chip--warn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  background: var(--warn-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--warn);
  flex-shrink: 0;
}

/* Icon chip — success (password updated) */
.reset-chip--success {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  background: var(--success-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--success);
  flex-shrink: 0;
}

/* Optional footer row: "Ricordi la password? Accedi →" */
.reset-footer {
  font-size: 13px;
  color: var(--ink-2);
  text-align: center;
  letter-spacing: -0.01em;
  line-height: 1.5;
}

.reset-footer a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}

.reset-footer a:hover { text-decoration: underline; }

/* ── State rules (class applied server-side by Razor Page) ───── */

/* is-error: validation mismatch — .is-invalid on #confirmPassword set server-side */
.reset-card.is-error .login-input.is-invalid       { border-color: var(--danger); background: var(--surface); }
.reset-card.is-error .login-input.is-invalid:focus { outline-color: var(--danger); }
.reset-card.is-error   .reset-field-error          { display: block; }

/* is-expired: hide form, show expired block */
.reset-card.is-expired .reset-form    { display: none; }
.reset-card.is-expired .reset-success { display: none; }
.reset-card.is-expired .reset-expired { display: flex; }

/* is-success: hide form + expired, show success block */
.reset-card.is-success .reset-form    { display: none; }
.reset-card.is-success .reset-expired { display: none; }
.reset-card.is-success .reset-success { display: flex; }


/* ═══════════════════════════════════════════════════════════════
   VARIANTE SPLIT — Login a due colonne
   Body class: .login-page--split
   Coesiste con .login-page (variante compact) senza conflitti.
   Nessuna classe esistente (.login-*) viene ridefinita qui —
   solo classi nuove (.split-*) e override scoped.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Page shell ── */
.login-page--split {
  min-height: 100vh;
  display: flex;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
}

/* ── 2. Left panel (brand/marketing) ── */
.split-panel {
  width: 45%;
  flex-shrink: 0;
  background-color: var(--ink);
  /* Dot texture: SVG data URL, non un gradient */
  background-image: url("data:image/svg+xml,%3Csvg width='28' height='28' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='14' cy='14' r='1' fill='rgba(255%2C255%2C255%2C0.05)'/%3E%3C/svg%3E");
  background-size: 28px 28px;
  display: flex;
  flex-direction: column;
  padding: 52px 56px;
  overflow: hidden;
}

/* Logo wordmark invertito — solo nel pannello sinistro */
.split-panel .login-logo__wordmark {
  color: #ffffff;
}

/* Area centrale: cresce per riempire lo spazio, spinge il footer in basso */
.split-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  padding: 48px 0;
}

.split-headline {
  font-size: 32px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: -0.04em;
  line-height: 1.18;
  margin-bottom: 14px;
}

.split-sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.48);
  letter-spacing: -0.01em;
  line-height: 1.6;
  margin-bottom: 36px;
  max-width: 340px;
}

.split-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.split-feature {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Micro-dot brand (solo uso decorativo di --brand) */
.split-feature__dot {
  width: 5px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 8px;
}

/* Footer copyright */
.split-footer {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: -0.01em;
  font-weight: 400;
}

/* ── 3. Right column (form) ── */
.split-form-col {
  flex: 1;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}

.split-form-inner {
  width: 100%;
  max-width: 380px;
}

/* Override dimensione titolo nel contesto split */
.split-form-inner .login-title {
  font-size: 22px;
}

/* Remember row: space-between per spingere il link a destra */
.split-form-inner .login-row {
  justify-content: space-between;
}

/* ── 4. "Password dimenticata?" link ── */
.split-forgot {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: color 0.12s ease;
}

.split-forgot:hover {
  color: var(--ink);
}

.split-forgot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── 5. Badge versione — solo mobile ── */
/* Nascosto su desktop; mostrato nella hero band su mobile. */
.split-badge {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-pill);
  margin-top: 16px;
  align-self: flex-start;
}

.split-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  flex-shrink: 0;
}

.split-badge__text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ── 6. Logo mobile (nascosto su desktop) ── */
/* Usato solo se il pannello sinistro è completamente assente.
   In questa variante il pannello rimane visibile su mobile come
   hero band, quindi questo elemento resta nascosto. */
.split-mobile-logo {
  display: none;
  margin-bottom: 28px;
}

/* ── 7. Responsive ≤ 768px ─────────────────────────────────── */
/* Mobile: il pannello sinistro diventa una hero band compatta
   impilata in cima. La colonna destra segue sotto con il form. */
@media (max-width: 768px) {
  .login-page--split {
    flex-direction: column;
    min-height: 100vh;
  }

  /* Hero band compatta — non nascosta, solo ridimensionata */
  .split-panel {
    display: flex;
    width: 100%;
    padding: 36px 24px 28px;
  }

  /* Nasconde le sezioni non necessarie nella hero band mobile */
  .split-sub,
  .split-features,
  .split-footer {
    display: none;
  }

  /* Titolo più compatto su mobile */
  .split-headline {
    font-size: 22px;
    letter-spacing: -0.035em;
    line-height: 1.2;
    margin-bottom: 0;
  }

  /* Rimuove il padding verticale dell'area contenuto */
  .split-content {
    padding: 20px 0 0;
    justify-content: flex-start;
    flex: unset;
  }

  /* Badge versione: visibile solo su mobile */
  .split-badge {
    display: flex;
  }

  /* Colonna destra: altezza automatica (non più full-viewport) */
  .split-form-col {
    flex: 1;
    min-height: unset;
    padding: 32px 24px 44px;
    align-items: flex-start;
  }

  .split-form-inner {
    max-width: 100%;
  }

  /* Il logo mobile rimane nascosto (il logo è nella hero band) */
  .split-mobile-logo {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════════
   PAGINA CONSENSI + OTP  (.consent-*)
   Route: /Consent/Confirm — link unico inviato via SMS/WhatsApp.
   La persona legge i consensi, (opz.) compila info extra,
   inserisce il codice OTP ricevuto e conferma.
   HTML: <main class="login-card consent-card @Model.CardState">
   Stati server-side: is-error · is-expired · is-success
   Estende wscan-login.css — non modifica i blocchi .login-* esistenti.
   ═══════════════════════════════════════════════════════════════ */

/* ── 1. Card più larga (più contenuto del login) ── */
.consent-card {
  max-width: 460px;
}

/* ── 2. Riga contesto: chi richiede / a quale numero ── */
.consent-context {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  margin-bottom: 24px;
}

.consent-context__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-2);
  flex-shrink: 0;
}

.consent-context__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.consent-context__label {
  font-size: 11px;
  color: var(--ink-muted);
  letter-spacing: -0.01em;
}

.consent-context__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
}

/* ── 3. Form wrapper ── */
.consent-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── 4. Sezione etichettata (Consensi / Info / Codice) ── */
.consent-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.consent-section__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── 5. Voce di consenso: checkbox + testo + badge ── */
.consent-item {
  display: flex;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.consent-item:hover {
  border-color: var(--border-strong);
}

/* Stato selezionato (aggiunto via JS quando la checkbox è :checked) */
.consent-item.is-checked {
  border-color: var(--ink);
  background: var(--surface-2);
}

/* Voce di consenso in errore (obbligatorio non spuntato al submit) */
.consent-item.is-error,
.consent-item.is-error:hover {
  border-color: var(--danger);
}

/* Messaggio di errore inline sotto la voce di consenso */
.consent-field-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  line-height: 1.4;
  margin-top: 4px;
  margin-bottom: 4px;
}

.consent-field-error.is-visible {
  display: block;
}

/* Hint sotto un .login-field (testo neutro 11.5 muted) */
.login-hint {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.35;
}

/* Input readonly: stile "valore noto", non focusabile come campo attivo */
.login-input[readonly] {
  background: var(--surface-alt);
  color: var(--ink-2);
  cursor: default;
}

/* Checkbox più grande del remember-me, allineata in alto */
.consent-item__check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  accent-color: var(--ink);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 1px;
}

.consent-item__main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.consent-item__head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.consent-item__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.consent-item__desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  letter-spacing: -0.005em;
}

.consent-item__desc a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── 6. Badge Obbligatorio / Facoltativo ── */
.consent-badge {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  line-height: 1.5;
  flex-shrink: 0;
}

.consent-badge--req {
  background: var(--ink);
  color: #ffffff;
}

.consent-badge--opt {
  background: var(--surface-alt);
  color: var(--ink-2);
  border: 1px solid var(--border);
}

/* ── 7. Codice OTP — celle separate ── */
.otp-row {
  display: flex;
  gap: 8px;
}

.otp-cell {
  flex: 1;
  min-width: 0;
  height: 52px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface-alt);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.otp-cell:hover:not(:focus) {
  border-color: var(--border-strong);
}

.otp-cell.is-filled {
  background: var(--surface);
  border-color: var(--border-strong);
}

.otp-cell:focus {
  background: var(--surface);
  border-color: var(--border-strong);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* Stato errore: applicato a tutte le celle quando .consent-card.is-error */
.otp-cell.is-invalid {
  border-color: var(--danger);
  background: var(--surface);
}

.otp-cell.is-invalid:focus {
  outline-color: var(--danger);
}

/* Riga sotto l'OTP: hint + link "Invia di nuovo" */
.otp-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.otp-hint {
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: -0.005em;
}

.consent-resend {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--font-sans);
  transition: color 0.12s ease;
}

.consent-resend:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-resend:disabled {
  color: var(--ink-muted);
  cursor: not-allowed;
  text-decoration: none;
}

.consent-resend:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Errore di campo OTP (codice errato) — sotto la riga celle */
.otp-error {
  display: none;
  font-size: 12px;
  color: var(--danger);
  font-weight: 500;
  line-height: 1.4;
}

/* ── 8. Legenda legale (small print) ── */
.consent-legal {
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.55;
  letter-spacing: -0.005em;
}

.consent-legal a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── 9. Blocco esito (expired / success) ── */
.consent-expired,
.consent-success {
  display: none;
  flex-direction: column;
}

/* ── State rules (classe applicata server-side sul .consent-card) ── */
.consent-card.is-error .otp-cell        { border-color: var(--danger); background: var(--surface); }
.consent-card.is-error .otp-cell:focus  { outline-color: var(--danger); }
.consent-card.is-error .otp-error       { display: block; }

.consent-card.is-expired .consent-form     { display: none; }
.consent-card.is-expired .consent-context  { display: none; }
.consent-card.is-expired .consent-success  { display: none; }
.consent-card.is-expired .consent-expired  { display: flex; }

.consent-card.is-success .consent-form     { display: none; }
.consent-card.is-success .consent-context  { display: none; }
.consent-card.is-success .consent-expired  { display: none; }
.consent-card.is-success .consent-success  { display: flex; }

/* ── 10. Responsive ── */
@media (max-width: 480px) {
  .otp-cell {
    height: 48px;
    font-size: 18px;
  }
}


/* ═══════════════════════════════════════════════════════════════
   CONSENSI in layout SPLIT (desktop)
   Body: .login-page--split · pannello scuro a sx + form a dx.
   Riusa .split-* e .consent-* — qui solo gli override necessari
   perché il contenuto consensi è più alto del login.
   ═══════════════════════════════════════════════════════════════ */

/* La colonna form deve poter scorrere se il contenuto supera l'altezza */
.split-form-col--scroll {
  align-items: flex-start;
  overflow-y: auto;
  padding-top: 56px;
  padding-bottom: 56px;
}

/* Centra verticalmente solo quando il contenuto ci sta */
.split-form-col--scroll > .split-form-inner {
  margin: auto;
}

/* Larghezza form consensi leggermente maggiore del login */
.split-form-inner.consent-split-inner {
  max-width: 420px;
}

/* Titolo nel contesto split (allineato a .split-form-inner .login-title) */
.consent-split-inner .login-title {
  font-size: 22px;
}

@media (max-width: 768px) {
  /* Su mobile la colonna non scrolla indipendentemente: scorre la pagina */
  .split-form-col--scroll {
    overflow-y: visible;
    padding-top: 32px;
    padding-bottom: 44px;
  }
  .split-form-col--scroll > .split-form-inner {
    margin: 0;
  }
}


/* ═══════════════════════════════════════════════════════════════
   PAGINA DOCUMENTO / INFORMATIVA  (.doc-*)
   Route: /privacy (o /Consent/Terms) — pagina di sola lettura
   aperta dai link "informativa privacy".
   Layout long-form leggibile, stessa palette del resto del sistema.
   ═══════════════════════════════════════════════════════════════ */

.doc-page {
  min-height: 100vh;
  background: var(--surface-2);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-wrap: pretty;
  padding: 40px 24px 80px;
}

.doc {
  max-width: 720px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 48px 56px;
}

/* Back link (riusa lo stile di .forgot-back) */
.doc-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  margin-bottom: 28px;
  letter-spacing: -0.01em;
  transition: color 0.12s ease;
}
.doc-back:hover { color: var(--ink); text-decoration: underline; }
.doc-back:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 3px; }

/* Header */
.doc-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 28px;
}

.doc-title {
  font-size: 27px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.035em;
  line-height: 1.18;
}

.doc-meta {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 10px;
  letter-spacing: -0.005em;
}

/* Indice (table of contents) */
.doc-toc {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 18px 20px;
  margin-bottom: 32px;
}

.doc-toc__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.doc-toc__list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 24px;
}

.doc-toc__list a {
  font-size: 13px;
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: -0.005em;
  transition: color 0.12s ease;
}
.doc-toc__list a:hover { color: var(--ink); text-decoration: underline; }

/* Corpo prosa */
.doc-body h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-top: 34px;
  margin-bottom: 10px;
  scroll-margin-top: 24px;
}
.doc-body h2:first-child { margin-top: 0; }

.doc-body h2 .doc-num {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  margin-right: 8px;
}

.doc-body h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  margin-top: 20px;
  margin-bottom: 6px;
}

.doc-body p {
  font-size: 14.5px;
  line-height: 1.72;
  color: var(--ink);
  margin-bottom: 14px;
  letter-spacing: -0.005em;
}

.doc-body ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.doc-body li {
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 7px;
  letter-spacing: -0.005em;
}

.doc-body li::marker { color: var(--ink-muted); }

.doc-body a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-body strong { font-weight: 600; }

/* Box evidenza (es. titolare del trattamento) */
.doc-callout {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 16px 18px;
  margin: 4px 0 18px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.doc-callout strong { color: var(--ink); }

/* Footer documento */
.doc-footer {
  border-top: 1px solid var(--border);
  margin-top: 36px;
  padding-top: 22px;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 600px) {
  .doc { padding: 32px 22px; }
  .doc-title { font-size: 23px; }
  .doc-toc__list { grid-template-columns: 1fr; }
}


/* ═══════════════════════════════════════════════════════════════
   ERROR PAGE — 404 / 500 / link non valido
   Estende wscan-login.css. Route interna: /error-page (UseStatusCodePages).
   Una sola .err-variant.is-active per richiesta (scelta server-side).
   ═══════════════════════════════════════════════════════════════ */

/* Una sola variante visibile per volta */
.err-variant { display: none; }
.err-variant.is-active { display: block; }

/* Icon chip 40×40 — stesso pattern di .reset-chip--* */
.err-chip {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.err-chip--danger { background: var(--danger-soft); color: var(--danger); }
.err-chip--muted  { background: var(--surface-alt); color: var(--ink-muted); }

/* Azioni in colonna (primaria + ghost) */
.err-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

/* Riferimento trace id (solo variante 500) */
.err-ref {
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: -0.01em;
  word-break: break-all;
}
.err-ref span { font-family: var(--font-mono); }


/* ── Consenso: conto alla rovescia scadenza OTP ──────────────── */
.otp-countdown {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ink-muted);
  letter-spacing: -0.01em;
}
.otp-countdown__time {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
/* Sotto i 30s: richiama l'attenzione */
.otp-countdown.is-urgent .otp-countdown__time { color: var(--danger); }
/* Scaduto: l'intero blocco in danger */
.otp-countdown.is-expired { color: var(--danger); }
.otp-countdown.is-expired .otp-countdown__time { color: var(--danger); }
