
.auth-page {
    min-height: 100vh;
    font-family: "Inter", sans-serif;
}

.auth-page-v2 {
    overflow-x: hidden;
    color-scheme: dark;
    background: #050505;
}

.auth-page-v2 .background {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.auth-page-v2 .background::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.42)),
        radial-gradient(circle at 50% 40%, transparent, rgba(0,0,0,.38));
}

.auth-shell {
    position: relative;
    z-index: 2;
    width: min(1220px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 28px 0 42px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.auth-brand {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: #fff;
}

.auth-brand strong {
    font-size: 17px;
    letter-spacing: -.03em;
}

.auth-card {
    position: relative;
    isolation: isolate;
    margin: auto 0;
    min-height: 680px;
    display: grid;
    grid-template-columns: minmax(0,.92fr) minmax(430px,1.08fr);
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 34px;
    background: rgba(8,8,8,.78);
    box-shadow: 0 34px 120px rgba(0,0,0,.58);
    backdrop-filter: blur(28px);
}

.auth-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,.045), transparent 38%);
    pointer-events: none;
}

.auth-copy {
    position: relative;
    min-width: 0;
    padding: clamp(42px,6vw,76px);
    display: flex;
    align-items: center;
    overflow: hidden;
    border-right: 1px solid rgba(255,255,255,.08);
    background:
        radial-gradient(circle at 22% 18%, rgba(212,175,55,.22), transparent 31%),
        radial-gradient(circle at 85% 84%, rgba(212,175,55,.08), transparent 32%),
        linear-gradient(145deg, rgba(212,175,55,.075), rgba(255,255,255,.012));
}

.auth-copy::before,
.auth-copy::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.auth-copy::before {
    width: 320px;
    height: 320px;
    top: -175px;
    right: -135px;
    border: 1px solid rgba(212,175,55,.15);
    box-shadow: 0 0 100px rgba(212,175,55,.07);
}

.auth-copy::after {
    width: 210px;
    height: 210px;
    left: -115px;
    bottom: -115px;
    border: 1px solid rgba(255,255,255,.07);
}

.auth-copy-inner {
    position: relative;
    z-index: 2;
    max-width: 510px;
}

.auth-kicker,
.card-label {
    color: var(--gold-light);
    font-size: 11px;
    font-weight: 850;
    letter-spacing: .2em;
}

.auth-copy h1,
.welcome-panel h1 {
    margin-top: 18px;
    color: #fff;
    font-size: clamp(42px,5vw,68px);
    line-height: 1.01;
    letter-spacing: -.06em;
}

.auth-copy > p,
.auth-copy-inner > p,
.welcome-panel > p {
    max-width: 540px;
    margin-top: 22px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.75;
}

.auth-benefits {
    margin-top: 36px;
    display: grid;
    gap: 14px;
}

.auth-benefits span {
    display: flex;
    align-items: center;
    gap: 11px;
    color: rgba(255,255,255,.76);
    font-size: 13px;
}

.auth-benefits i,
.status-pill i {
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 18px rgba(212,175,55,.75);
}

.auth-trust-card {
    margin-top: 34px;
    padding: 15px;
    display: grid;
    grid-template-columns: 40px minmax(0,1fr);
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 15px;
    background: rgba(255,255,255,.025);
}

.auth-trust-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--gold-light);
    background: rgba(212,175,55,.09);
    font-weight: 900;
}

.auth-trust-card strong,
.auth-trust-card p {
    display: block;
}

.auth-trust-card strong {
    color: #fff;
    font-size: 12px;
}

.auth-trust-card p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.auth-form-wrap {
    min-width: 0;
    padding: clamp(36px,5.5vw,68px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: rgba(5,5,5,.42);
}

.auth-form-heading {
    margin-bottom: 27px;
}

.auth-form-heading h2 {
    color: #fff;
    font-size: clamp(30px,3vw,40px);
    letter-spacing: -.045em;
}

.auth-form-heading p {
    margin-top: 9px;
    color: var(--muted);
    font-size: 13px;
}

.auth-form-heading a {
    color: var(--gold-light);
    font-weight: 750;
}

.form-alert {
    position: relative;
    margin-bottom: 18px;
    padding: 15px 16px 15px 43px;
    border-radius: 14px;
    font-size: 12px;
    line-height: 1.5;
}

.form-alert::before {
    position: absolute;
    left: 16px;
    top: 14px;
    font-weight: 900;
}

.form-alert.error {
    color: #ffd0d0;
    border: 1px solid rgba(255,91,91,.22);
    background: rgba(255,91,91,.075);
}

.form-alert.error::before {
    content: "!";
    color: #ff9b9b;
}

.form-alert.success {
    color: #d8ffd0;
    border: 1px solid rgba(125,220,95,.22);
    background: rgba(125,220,95,.07);
}

.form-alert.success::before {
    content: "✓";
    color: #9ff0ba;
}

.form-alert p + p {
    margin-top: 4px;
}

.auth-form {
    min-width: 0;
    display: grid;
    gap: 16px;
}

.auth-form > label > span {
    display: block;
    margin-bottom: 8px;
    color: rgba(255,255,255,.79);
    font-size: 12px;
    font-weight: 700;
}

.auth-input-shell,
.password-field {
    position: relative;
    width: 100%;
    min-width: 0;
}

.auth-input-icon {
    position: absolute;
    z-index: 2;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    color: rgba(212,175,55,.78);
    font-size: 13px;
    font-weight: 850;
    text-align: center;
    pointer-events: none;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 0 16px 0 46px;
    box-sizing: border-box;
    color: #fff;
    font: inherit;
    border: 1px solid rgba(255,255,255,.105);
    border-radius: 14px;
    outline: none;
    background: rgba(255,255,255,.035);
    transition: border-color .2s, background .2s, box-shadow .2s;
}

.auth-form input:focus {
    border-color: rgba(212,175,55,.58);
    background: rgba(255,255,255,.052);
    box-shadow: 0 0 0 4px rgba(212,175,55,.075);
}

.auth-form input::placeholder {
    color: rgba(255,255,255,.28);
}

.auth-form input.password-mismatch {
    border-color: rgba(255,91,91,.55);
    box-shadow: 0 0 0 4px rgba(255,91,91,.06);
}

.password-field input {
    padding-right: 98px !important;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 9px;
    z-index: 3;
    transform: translateY(-50%);
    min-width: 75px;
    min-height: 38px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: rgba(212,175,55,.09);
    color: var(--gold-light) !important;
    -webkit-text-fill-color: var(--gold-light) !important;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: rgba(212,175,55,.16);
}

.password-toggle:focus-visible {
    outline: 2px solid rgba(245,223,150,.72);
    outline-offset: 2px;
}

.auth-secure-note {
    padding: 12px 13px;
    display: grid;
    grid-template-columns: 27px minmax(0,1fr);
    align-items: start;
    gap: 9px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px;
    background: rgba(255,255,255,.02);
}

.auth-secure-note > span {
    width: 27px;
    height: 27px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--gold-light);
    background: rgba(212,175,55,.08);
    font-size: 11px;
}

.auth-secure-note p {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.auth-secure-note strong {
    color: rgba(255,255,255,.86);
}

.auth-submit {
    width: 100%;
    height: 56px;
    margin-top: 1px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 13px;
    border: 0;
    border-radius: 14px;
    color: #12100a !important;
    -webkit-text-fill-color: #12100a !important;
    background: linear-gradient(135deg,var(--gold-light),var(--gold));
    box-shadow: 0 18px 38px rgba(212,175,55,.16);
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    transition: transform .2s,box-shadow .2s,filter .2s;
    -webkit-appearance: none;
    appearance: none;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 46px rgba(212,175,55,.22);
    filter: brightness(1.03);
}

.auth-submit:disabled {
    cursor: wait;
    opacity: .78;
    transform: none;
}

.auth-submit > span:not(.auth-spinner) {
    font-size: 19px;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(18,16,10,.24);
    border-top-color: #12100a;
    border-radius: 50%;
    animation: auth-spin .7s linear infinite;
}

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

.auth-switch {
    margin-top: 2px;
    padding-top: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-top: 1px solid rgba(255,255,255,.06);
    color: var(--muted);
    font-size: 11px;
    text-align: center;
}

.auth-switch a {
    color: var(--gold-light);
    font-weight: 800;
}

.password-strength {
    padding: 13px;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 13px;
    background: rgba(255,255,255,.02);
}

.password-strength-bar {
    height: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255,255,255,.07);
}

.password-strength-bar span {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: #a65c5c;
    transition: width .22s ease,background .22s ease;
}

.password-strength[data-level="2"] .password-strength-bar span {
    background: #c59b4a;
}

.password-strength[data-level="3"] .password-strength-bar span,
.password-strength[data-level="4"] .password-strength-bar span {
    background: #79bd72;
}

.password-strength-copy {
    margin-top: 9px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.password-strength-copy strong {
    color: rgba(255,255,255,.79);
    font-size: 10px;
}

.password-strength-copy span {
    color: var(--muted);
    font-size: 10px;
    text-align: right;
}

.password-strength ul {
    margin: 10px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 7px 13px;
    list-style: none;
}

.password-strength li {
    color: rgba(255,255,255,.35);
    font-size: 9px;
}

.password-strength li::before {
    content: "○";
    margin-right: 5px;
}

.password-strength li.valid {
    color: #9fd49c;
}

.password-strength li.valid::before {
    content: "✓";
}

.recaptcha-wrap {
    width: 100%;
    margin: 2px 0;
    padding: 13px 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.065);
    border-radius: 13px;
    background: rgba(255,255,255,.018);
}

.recaptcha-wrap > div,
.recaptcha-wrap .g-recaptcha {
    margin: 0 auto;
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"],
.auth-submit,
.password-toggle {
    -webkit-appearance: none;
    appearance: none;
    text-decoration: none;
    -webkit-text-fill-color: currentColor;
}

.auth-card,
.auth-copy,
.auth-copy-inner,
.auth-form-wrap,
.auth-form,
.auth-form label,
.auth-input-shell,
.password-field,
.auth-form input,
.auth-form button {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* Shared legacy dashboard rules kept for compatibility */
.dashboard-nav {
    position: relative;
    z-index: 3;
    width: min(1180px,calc(100% - 40px));
    margin: 0 auto;
    padding: 30px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logout-link {
    padding: 11px 17px;
    border: 1px solid rgba(255,255,255,.13);
    border-radius: 999px;
    color: rgba(255,255,255,.74);
    font-size: 13px;
    font-weight: 700;
}

.dashboard-shell {
    position: relative;
    z-index: 2;
    width: min(1180px,calc(100% - 40px));
    margin: 70px auto;
}

.welcome-panel {
    max-width: 850px;
}

.dashboard-grid {
    margin-top: 52px;
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 18px;
}

.dashboard-card {
    min-height: 250px;
    padding: 30px;
    border: 1px solid rgba(255,255,255,.11);
    border-radius: 24px;
    background: rgba(255,255,255,.045);
    backdrop-filter: blur(18px);
}

.dashboard-card h2 {
    margin-top: 18px;
    color: #fff;
    font-size: 24px;
}

.dashboard-card p {
    margin-top: 12px;
    color: var(--muted);
    line-height: 1.65;
}

@media (max-width: 900px) {
    .auth-card {
        grid-template-columns: minmax(0,1fr);
        min-height: auto;
    }

    .auth-copy {
        min-height: 340px;
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }

    .auth-copy-inner {
        max-width: 720px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2,minmax(0,1fr));
    }
}

@media (max-width: 620px) {
    .auth-shell,
    .dashboard-nav,
    .dashboard-shell {
        width: min(100% - 24px,1220px);
    }

    .auth-shell {
        padding: max(17px,env(safe-area-inset-top)) 0 calc(26px + env(safe-area-inset-bottom));
    }

    .auth-brand strong {
        font-size: 15px;
    }

    .auth-card {
        margin-top: 22px;
        border-radius: 22px;
    }

    .auth-copy {
        min-height: auto;
        padding: 28px 21px;
    }

    .auth-copy h1 {
        font-size: clamp(34px,11vw,42px);
    }

    .auth-copy-inner > p {
        margin-top: 15px;
        font-size: 14px;
    }

    .auth-benefits {
        margin-top: 24px;
        gap: 11px;
    }

    .auth-benefits span {
        font-size: 12px;
    }

    .auth-trust-card {
        margin-top: 23px;
    }

    .auth-form-wrap {
        padding: 27px 19px;
    }

    .auth-form {
        gap: 15px;
    }

    .auth-form input[type="text"],
    .auth-form input[type="email"],
    .auth-form input[type="password"] {
        font-size: 16px;
    }

    .password-strength-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .password-strength-copy span {
        text-align: left;
    }

    .auth-switch {
        align-items: center;
        flex-direction: column;
        gap: 4px;
    }

    .recaptcha-wrap {
        padding-inline: 4px;
    }

    .recaptcha-wrap .g-recaptcha {
        transform: scale(.91);
        transform-origin: center top;
    }

    .dashboard-grid {
        grid-template-columns: minmax(0,1fr);
    }
}

@media (max-width: 390px) {
    .auth-copy {
        padding: 24px 18px;
    }

    .auth-form-wrap {
        padding: 25px 16px;
    }

    .password-field input {
        padding-right: 88px !important;
    }

    .password-toggle {
        min-width: 67px;
        padding-inline: 8px;
        font-size: 10px;
    }

    .recaptcha-wrap .g-recaptcha {
        transform: scale(.84);
    }
}

@media (hover: none) {
    .auth-submit:hover {
        transform: none;
        filter: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit,
    .password-strength-bar span {
        transition: none !important;
    }

    .auth-spinner {
        animation-duration: 1.2s;
    }
}


/* =====================================================
   FIX REGISTRAZIONE MOBILE — larghezza card / reCAPTCHA
===================================================== */
@media (max-width: 620px) {
    .auth-register-page .auth-shell {
        width: calc(100% - 24px) !important;
        max-width: calc(100% - 24px) !important;
        margin-inline: auto !important;
        overflow: visible;
    }

    .auth-register-page .auth-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        grid-template-columns: minmax(0, 1fr) !important;
        justify-self: stretch;
    }

    .auth-register-page .auth-copy,
    .auth-register-page .auth-form-wrap,
    .auth-register-page .auth-form,
    .auth-register-page .auth-field,
    .auth-register-page .auth-input-shell,
    .auth-register-page .password-field,
    .auth-register-page .password-strength,
    .auth-register-page .auth-secure-note,
    .auth-register-page .auth-switch,
    .auth-register-page .recaptcha-wrap {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .auth-register-page .recaptcha-wrap {
        display: block !important;
        overflow: hidden !important;
        text-align: center;
    }

    .auth-register-page .recaptcha-wrap .g-recaptcha {
        width: 304px;
        max-width: none !important;
        margin-inline: auto !important;
        transform: scale(.88);
        transform-origin: center top;
    }
}

@media (max-width: 360px) {
    .auth-register-page .recaptcha-wrap .g-recaptcha {
        transform: scale(.80);
    }
}


/* =====================================================
   FIX REGISTRAZIONE MOBILE — distanza logo/card
===================================================== */
@media (max-width: 620px) {
    .auth-register-page .auth-card {
        margin-top: 34px !important;
    }

    .auth-register-page .auth-brand {
        position: relative;
        z-index: 3;
        margin-left: 2px;
    }
}

@media (max-width: 390px) {
    .auth-register-page .auth-card {
        margin-top: 38px !important;
    }
}


/* =====================================================
   FIX REGISTRAZIONE DESKTOP — distanza logo/card
===================================================== */
.auth-register-page .auth-shell {
    gap: 30px;
}

.auth-register-page .auth-card {
    margin-top: 0 !important;
    margin-bottom: auto;
}

@media (max-width: 620px) {
    .auth-register-page .auth-shell {
        gap: 0;
    }

    .auth-register-page .auth-card {
        margin-top: 34px !important;
    }
}
