/* Pagine di accesso (login, credenziali non valide, recupero e reset password).
   Schermo diviso: a sinistra il pannello del marchio (parts/auth_brand.edge) con i riquadri inclinati,
   a destra il modulo. Tema scuro, accento giallo Kipanga con testo scuro (mai bianco su giallo).
   Su schermi stretti il pannello del marchio diventa una fascia in alto con il solo logo. */

.auth-page {
    --auth-bg: #0F1115;
    --auth-brand-bg: #14171D;
    --auth-surface: #171A21;
    --auth-border: #2A2F3A;
    --auth-border-strong: #3A404D;
    --auth-text: #ECEEF2;
    --auth-text-muted: #9098A6;
    --auth-text-faint: #646C7A;
    --auth-accent: var(--giallo-kipanga, #F4C018);
    --auth-accent-hover: #E5B20F;
    --auth-danger: #F87171;
    --auth-success: #4ADE80;

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    /* altezza fissa che scorre: il body è bloccato da generale.css per tutto il sito */
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    background: var(--auth-bg);
    color: var(--auth-text);
}

.auth-page .icon {
    width: 1.05rem;
    height: 1.05rem;
    flex: none;
}

/* ---------------- pannello del marchio ---------------- */

.auth-brand {
    position: relative;
    display: flex;
    min-height: 100%;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 2.5rem 3rem;
    overflow: hidden;
    border-right: 1px solid var(--auth-border);
    background: var(--auth-brand-bg);
}

/* riquadri inclinati sullo sfondo: richiamano gli schermi, solo decorazione */
.auth-brand__tiles {
    position: absolute;
    inset: -30% -40% -30% -10%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 18px;
    transform: rotate(-12deg);
    pointer-events: none;
}

.auth-brand__tiles span {
    aspect-ratio: 9 / 14;
    border: 1px solid rgb(255 255 255 / 4%);
    border-radius: 14px;
    background: rgb(255 255 255 / 2.5%);
}

.auth-brand__tiles span:nth-child(9),
.auth-brand__tiles span:nth-child(22) {
    border-color: rgb(244 192 24 / 14%);
    background: rgb(244 192 24 / 7%);
}

.auth-brand__tiles span:nth-child(16),
.auth-brand__tiles span:nth-child(29) {
    background: rgb(74 222 128 / 4%);
}

/* sfumatura: il testo resta leggibile sopra i riquadri */
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgb(20 23 29 / 96%) 0%, rgb(20 23 29 / 70%) 55%, rgb(20 23 29 / 35%) 100%);
    pointer-events: none;
}

.auth-brand > :not(.auth-brand__tiles) {
    position: relative;
    z-index: 1;
}

.auth-brand__logo {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    padding: .55rem .85rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 20px rgb(0 0 0 / 35%);
}

/* altezza fissa: gli SVG senza dimensioni proprie altrimenti si riducono a zero */
.auth-brand__logo img {
    display: block;
    width: auto;
    height: 2.2rem;
    max-width: 180px;
    object-fit: contain;
}

.auth-brand__copy {
    max-width: 30rem;
}

.auth-brand__eyebrow {
    margin: 0 0 .9rem;
    color: var(--auth-accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .72rem;
    letter-spacing: .22em;
    text-transform: uppercase;
}

.auth-brand__title {
    margin: 0 0 1.1rem;
    color: #fff;
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    font-weight: 700;
    line-height: 1.04;
    letter-spacing: -.02em;
}

.auth-brand__text {
    margin: 0;
    color: var(--auth-text-muted);
    font-size: 1.02rem;
    line-height: 1.55;
}

.auth-brand__foot {
    margin: 0;
    color: var(--auth-text-faint);
    font-size: .8rem;
}

/* ---------------- modulo ---------------- */

.auth-panel {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    width: 100%;
    max-width: 25rem;
}

.auth-card--center {
    text-align: center;
}

/* il logo dentro la card non serve più (è nel pannello del marchio) */
.auth-logo {
    display: none;
}

.auth-card__heading {
    margin-bottom: 1.75rem;
}

.auth-card__heading h1,
.auth-card__heading h2 {
    margin: 0 0 .5rem;
    color: #fff;
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -.01em;
}

.auth-card__heading p {
    margin: 0;
    color: var(--auth-text-muted);
    font-size: .98rem;
    line-height: 1.5;
}

.auth-card__heading a {
    color: var(--auth-accent);
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: .45rem;
    text-align: left;
}

.auth-field__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.auth-field label {
    margin: 0;
    color: var(--auth-text);
    font-size: .85rem;
    font-weight: 600;
}

.auth-field__link {
    color: var(--auth-text-muted);
    font-size: .82rem;
    text-decoration: none;
}

.auth-field__link:hover,
.auth-field__link:focus-visible {
    color: var(--auth-accent);
    text-decoration: underline;
}

.auth-page .form-control {
    min-height: 48px;
    padding: .7rem .9rem;
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    background: var(--auth-surface);
    color: var(--auth-text);
    font-size: .98rem;
    box-shadow: none;
}

.auth-page .form-control::placeholder {
    color: var(--auth-text-faint);
}

.auth-page .form-control:focus {
    border-color: var(--auth-accent);
    background: var(--auth-surface);
    color: var(--auth-text);
    box-shadow: 0 0 0 3px rgb(244 192 24 / 22%);
}

/* riempimento automatico del browser: niente sfondo azzurro/giallo chiaro sul tema scuro */
.auth-page .form-control:-webkit-autofill {
    -webkit-text-fill-color: var(--auth-text);
    box-shadow: 0 0 0 1000px var(--auth-surface) inset;
    caret-color: var(--auth-text);
}

.auth-password {
    position: relative;
}

.auth-password .form-control {
    padding-right: 6.5rem;
}

.auth-password__toggle {
    position: absolute;
    top: 50%;
    right: .4rem;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    height: 34px;
    padding: 0 .65rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-text-muted);
    font-size: .8rem;
    font-weight: 600;
    transform: translateY(-50%);
    cursor: pointer;
}

.auth-password__toggle:hover {
    background: rgb(255 255 255 / 6%);
    color: var(--auth-text);
}

.auth-password__toggle[aria-pressed="true"] {
    color: var(--auth-accent);
}

.auth-capslock {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--auth-accent);
    font-size: .8rem;
    font-weight: 600;
}

.auth-capslock[hidden] {
    display: none;
}

.auth-capslock .icon {
    width: .9rem;
    height: .9rem;
}

.auth-checkbox {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: .55rem;
    margin: 0;
    color: var(--auth-text-muted);
    font-size: .88rem;
    cursor: pointer;
}

.auth-checkbox input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--auth-accent);
    cursor: pointer;
}

.auth-checkbox label {
    margin: 0;
    color: var(--auth-text-muted);
    font-size: .88rem;
}

/* principale: giallo Kipanga, testo scuro */
.auth-submit {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    margin-top: .25rem;
    padding: .7rem 1rem;
    border: 0;
    border-radius: 10px;
    background: var(--auth-accent);
    color: #1e1e1e;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease;
}

.auth-submit:hover,
.auth-submit:focus-visible {
    background: var(--auth-accent-hover);
    color: #1e1e1e;
}

.auth-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.auth-btn-secondary {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .7rem 1rem;
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    background: transparent;
    color: var(--auth-text);
    font-size: .98rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}

.auth-btn-secondary:hover,
.auth-btn-secondary:focus-visible {
    border-color: var(--auth-text-faint);
    background: rgb(255 255 255 / 4%);
    color: #fff;
}

.auth-page a:focus-visible,
.auth-page button:focus-visible,
.auth-page input:focus-visible {
    outline: 3px solid rgb(244 192 24 / 55%);
    outline-offset: 2px;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin: 1.5rem 0;
    color: var(--auth-text-faint);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .7rem;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-note {
    margin: .7rem 0 0;
    color: var(--auth-text-faint);
    font-size: .8rem;
    text-align: center;
}

.auth-links {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--auth-border);
    color: var(--auth-text-muted);
    font-size: .88rem;
    text-align: center;
}

.auth-links a {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

.auth-alert {
    margin-bottom: 1.1rem;
    padding: .75rem .9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: .9rem;
    font-weight: 500;
    text-align: left;
}

.auth-alert--success {
    border-color: rgb(74 222 128 / 30%);
    background: rgb(74 222 128 / 10%);
    color: var(--auth-success);
}

.auth-alert--error {
    border-color: rgb(248 113 113 / 35%);
    background: rgb(248 113 113 / 10%);
    color: var(--auth-danger);
}

.auth-error-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    margin: 0 auto 1.25rem;
    border-radius: 999px;
    background: rgb(248 113 113 / 12%);
    color: var(--auth-danger);
}

.auth-error-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* ---------------- schermi stretti ---------------- */

@media (max-width: 960px) {
    .auth-page {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .auth-brand {
        min-height: 0;
        padding: 1.25rem 1.5rem;
        border-right: 0;
        border-bottom: 1px solid var(--auth-border);
    }

    .auth-brand__copy,
    .auth-brand__foot {
        display: none;
    }

    .auth-panel {
        align-items: flex-start;
        padding: 2rem 1.25rem 2.5rem;
    }

    .auth-card__heading h1,
    .auth-card__heading h2 {
        font-size: 1.6rem;
    }
}

@media (max-height: 640px) and (min-width: 961px) {
    .auth-brand__title {
        font-size: 2.2rem;
    }
}
