/* =====================================================================
   AUTH — accedi / accedi_sent / accedi_error  (design system «Registro»)
   ===================================================================== */
.auth-page { padding-top: clamp(2rem, 4vw, 3.5rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.auth-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); gap: clamp(2rem, 5vw, 5rem); align-items: start; }

/* Colonna sinistra: perché registrarsi */
.auth-intro .ph-eyebrow { margin-bottom: 1rem; }
.auth-intro h1 { font-size: clamp(2.2rem, 4.2vw, 3.4rem); max-width: 14ch; margin-bottom: 1rem; text-wrap: balance; }
.auth-intro .lede { font-size: var(--fs-md); color: var(--ink-3); max-width: 52ch; margin-bottom: 2rem; line-height: 1.6; }
.auth-steps { list-style: none; display: flex; flex-direction: column; gap: 0; counter-reset: step; }
.auth-steps li { display: grid; grid-template-columns: 40px 1fr; gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--line-2); }
.auth-steps li:last-child { border-bottom: 1px solid var(--line-2); }
.auth-steps .perk-num {
    width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); background: var(--gold-soft); border: 1px solid var(--gold-line);
}
.auth-steps .perk-t { font-weight: 600; color: var(--ink); margin-bottom: 0.2rem; }
.auth-steps .perk-d { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.55; }

/* Card form */
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden; position: relative; }
.auth-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--accent-deep), var(--gold)); }
.auth-card-inner { padding: 2rem 2rem 1.75rem; }
.auth-card-badge {
    display: inline-flex; align-items: center; gap: 0.4rem; margin-bottom: 1rem; padding: 0.3rem 0.7rem; border-radius: var(--r-pill);
    font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; background: var(--navy-soft); color: var(--navy);
}
.auth-card-badge svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.auth-card h2 { font-size: 1.6rem; margin-bottom: 0.4rem; }
.auth-card .sub { font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: 1.4rem; line-height: 1.55; }
.auth-err {
    display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.1rem; padding: 0.75rem 0.95rem; border-radius: var(--r-sm);
    background: var(--red-soft); color: var(--red-deep); font-size: var(--fs-sm); font-weight: 600; border: 1px solid #f0c6c1;
}
.auth-err svg { width: 18px; height: 18px; flex-shrink: 0; }
.auth-form .fld-label { margin-bottom: 0.45rem; }
.email-wrap { position: relative; margin-bottom: 1.1rem; }
.email-wrap::before {
    content: ''; position: absolute; left: 0.9rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236d675e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2'/%3E%3Cpath d='M3 7l9 6 9-6'/%3E%3C/svg%3E") no-repeat center / contain;
}
.email-wrap input[type="email"] { width: 100%; min-height: 48px; padding: 0.7rem 0.9rem 0.7rem 2.6rem; font-size: var(--fs-base); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.email-wrap input[type="email"]:focus { outline: none; border-color: var(--navy); box-shadow: var(--focus-ring); }
.consent-block { display: flex; flex-direction: column; gap: 0.7rem; margin-bottom: 1.25rem; padding: 0.9rem 1rem; background: var(--paper); border-radius: var(--r-sm); border: 1px solid var(--line); }
.auth-check { display: flex; gap: 0.65rem; align-items: flex-start; cursor: pointer; font-size: 0.8rem; line-height: 1.5; color: var(--ink-3); }
.auth-check input[type="checkbox"] { flex-shrink: 0; width: 17px; height: 17px; margin-top: 0.15rem; accent-color: var(--ink); cursor: pointer; }
.auth-check a { color: var(--navy); font-weight: 600; border-bottom: 1px solid var(--gold-line); }
.auth-check .req { display: inline-block; margin-left: 0.35rem; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-deep); }
.auth-check .tag { display: inline-block; margin-right: 0.35rem; padding: 0.05rem 0.45rem; border-radius: 4px; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; background: var(--green-soft); color: var(--green); vertical-align: middle; }
.auth-submit {
    width: 100%; min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    border-radius: var(--r-pill); background: var(--ink); color: #fff; font-size: 0.95rem; font-weight: 600; border: 1px solid var(--ink);
    box-shadow: var(--shadow-sm); transition: background var(--dur-fast), transform var(--dur-fast), box-shadow var(--dur-fast); position: relative;
}
.auth-submit:hover { background: var(--ink-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.auth-submit:disabled { opacity: 0.75; cursor: wait; transform: none; }
.auth-submit .icon-arrow { width: 16px; height: 16px; stroke-width: 2.2; }
.auth-submit .spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: auth-spin 0.8s linear infinite; }
.auth-submit.is-loading .icon-arrow { display: none; }
.auth-submit.is-loading .spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-footnote { margin-top: 1.1rem; font-size: 0.74rem; line-height: 1.55; color: var(--muted); }
.auth-footnote strong { color: var(--ink-3); }
.auth-footnote a { color: var(--navy); font-weight: 600; }

/* Trust strip */
.auth-trust { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; margin-top: clamp(2rem, 4vw, 3.5rem); }
.trust-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.35rem 1.4rem; box-shadow: var(--shadow-xs); }
.trust-card .ic { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--navy-soft); margin-bottom: 0.8rem; }
.trust-card .ic svg { width: 20px; height: 20px; stroke: var(--navy); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.trust-card h4 { font-family: var(--font); font-size: 0.95rem; font-weight: 650; margin-bottom: 0.3rem; letter-spacing: 0; }
.trust-card p { font-size: 0.82rem; color: var(--ink-3); line-height: 1.55; }

/* ---------- Pagine di stato (sent / error) ---------- */
.state-page { max-width: 720px; margin: 0 auto; padding-top: clamp(2.5rem, 5vw, 4rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.state-head { text-align: center; margin-bottom: 1.75rem; }
.state-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 1.2rem; display: flex; align-items: center; justify-content: center; position: relative; }
.state-icon svg { width: 32px; height: 32px; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.state-icon--ok { background: var(--green-soft); } .state-icon--ok svg { stroke: var(--green); }
.state-icon--err { background: var(--red-soft); } .state-icon--err svg { stroke: var(--red); }
.state-icon .ping { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--green); opacity: 0; animation: state-ping 2.2s ease-out infinite; }
@keyframes state-ping { 0% { transform: scale(0.85); opacity: 0.7; } 100% { transform: scale(1.35); opacity: 0; } }
.state-head .ph-eyebrow { justify-content: center; }
.state-head .ph-eyebrow::before { display: none; }
.state-head h1 { font-size: clamp(2rem, 4vw, 2.9rem); margin-bottom: 0.75rem; }
.state-head .lede { font-size: var(--fs-md); color: var(--ink-3); max-width: 50ch; margin: 0 auto; line-height: 1.6; }
.email-badge-big {
    display: inline-flex; align-items: center; gap: 0.55rem; margin-top: 1.1rem; padding: 0.55rem 1rem; border-radius: var(--r-pill);
    background: var(--surface); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 0.9rem; font-weight: 600; color: var(--ink); box-shadow: var(--shadow-xs);
    max-width: 100%; overflow-wrap: anywhere;
}
.email-badge-big svg { width: 16px; height: 16px; stroke: var(--navy); fill: none; stroke-width: 2; flex-shrink: 0; }
.state-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: 1.75rem 2rem; }
.state-card h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.state-alert { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1.25rem; padding: 0.8rem 1rem; border-radius: var(--r-sm); background: var(--red-soft); border: 1px solid #f0c6c1; color: var(--red-deep); font-weight: 600; font-size: var(--fs-sm); }
.state-alert svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.sent-checklist, .err-reasons { list-style: none; display: flex; flex-direction: column; }
.sent-checklist li, .err-reasons li { display: grid; grid-template-columns: 32px 1fr; gap: 0.85rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.sent-checklist li:first-child, .err-reasons li:first-child { border-top: 0; padding-top: 0; }
.step-n, .bang { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 0.78rem; font-weight: 600; background: var(--paper-2); color: var(--ink-3); }
.step-n { background: var(--ink); color: #fff; }
.step-t { font-weight: 600; color: var(--ink); margin-bottom: 0.15rem; }
.step-d, .err-reasons li div { font-size: var(--fs-sm); color: var(--ink-3); line-height: 1.55; }
.step-d code { font-family: var(--mono); font-size: 0.78rem; background: var(--paper-2); padding: 0.1rem 0.4rem; border-radius: 4px; color: var(--ink); }
.err-reasons strong { color: var(--ink); }
.sent-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.timing { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.78rem; font-weight: 600; color: var(--ink-3); }
.timing .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: tick-pulse 1.6s infinite; }
.sent-link-back, .state-back { font-size: var(--fs-sm); font-weight: 600; color: var(--navy); }
.sent-link-back:hover, .state-back:hover { color: var(--accent-deep); }
.mail-shortcuts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.25rem; }
.mail-shortcut { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem; border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--surface); font-size: 0.8rem; font-weight: 600; color: var(--ink-2); transition: border-color var(--dur-fast), background var(--dur-fast); }
.mail-shortcut:hover { border-color: var(--ink); background: var(--paper); }
.mail-shortcut .dot { width: 8px; height: 8px; border-radius: 50%; }
.state-note { text-align: center; margin-top: 1.75rem; font-size: var(--fs-sm); color: var(--muted); line-height: 1.6; }
.state-note strong { color: var(--ink-3); }
.state-note a { color: var(--navy); font-weight: 600; border-bottom: 1px solid var(--gold-line); }
.dev-link { margin-top: 1.25rem; padding: 0.9rem 1rem; border-radius: var(--r-sm); background: var(--ink); color: rgba(255,255,255,0.8); font-size: 0.78rem; overflow-wrap: anywhere; }
.dev-link .lbl { display: block; font-size: 0.62rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: #f0cd7a; margin-bottom: 0.4rem; }
.dev-link a { color: #fff; font-family: var(--mono); }
.err-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 1.25rem; }
.err-actions .ph-cta { min-height: 46px; }
.state-code { display: inline-block; margin-left: 0.5rem; padding: 0.15rem 0.5rem; border-radius: 4px; background: var(--paper-2); font-family: var(--mono); font-size: 0.66rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: none; }

@media (max-width: 900px) {
    .auth-grid { grid-template-columns: 1fr; gap: 2rem; }
    .auth-card { order: -1; }
    .auth-intro h1 { max-width: none; }
    .auth-trust { grid-template-columns: 1fr; gap: 0.9rem; }
    .auth-card-inner { padding: 1.5rem 1.25rem 1.4rem; }
    .state-card { padding: 1.4rem 1.25rem; }
    .err-actions .ph-cta { width: 100%; justify-content: center; }
}
