:root {
            --primary: #c0392b;
            --primary-dark: #96281b;
            --primary-light: #fadbd8;
            --danger: #ef4444;
        }

        /* ===================== TEMA DARK (default) ===================== */
        body, body.dark-theme {
            --bg: #0f1117;
            --bg-brand: #0f1117;
            --text: #ffffff;
            --text-muted: rgba(255, 255, 255, 0.5);
            --text-label: rgba(255, 255, 255, 0.6);
            --text-footer: rgba(255, 255, 255, 0.3);
            --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.03) 100%);
            --glass-border: rgba(255, 255, 255, 0.08);
            --input-bg: rgba(255, 255, 255, 0.05);
            --input-border: rgba(255, 255, 255, 0.1);
            --input-hover-bg: rgba(255, 255, 255, 0.07);
            --input-hover-border: rgba(255, 255, 255, 0.18);
            --input-placeholder: rgba(255, 255, 255, 0.2);
            --input-icon: rgba(255, 255, 255, 0.25);
            --checkbox-text: rgba(255, 255, 255, 0.5);
            --toggle-hover: rgba(255, 255, 255, 0.5);
            --footer-border: rgba(255, 255, 255, 0.06);
            --pill-bg: rgba(255, 255, 255, 0.05);
            --pill-border: rgba(255, 255, 255, 0.08);
            --pill-text: rgba(255, 255, 255, 0.6);
            --grid-color: rgba(192, 57, 43, 0.06);
            --orb-opacity: 0.4;
            --campo-errore: #f87171;
        }

        /* ===================== TEMA LIGHT ===================== */
        body.light-theme {
            --bg: #f0f2f5;
            --bg-brand: #f8f9fb;
            --text: #1f2937;
            --text-muted: rgba(31, 41, 55, 0.55);
            --text-label: rgba(31, 41, 55, 0.65);
            --text-footer: rgba(31, 41, 55, 0.35);
            --glass-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0.7) 100%);
            --glass-border: rgba(0, 0, 0, 0.08);
            --input-bg: rgba(0, 0, 0, 0.03);
            --input-border: rgba(0, 0, 0, 0.1);
            --input-hover-bg: rgba(0, 0, 0, 0.05);
            --input-hover-border: rgba(0, 0, 0, 0.15);
            --input-placeholder: rgba(0, 0, 0, 0.3);
            --input-icon: rgba(0, 0, 0, 0.25);
            --checkbox-text: rgba(31, 41, 55, 0.55);
            --toggle-hover: rgba(0, 0, 0, 0.5);
            --footer-border: rgba(0, 0, 0, 0.06);
            --pill-bg: rgba(0, 0, 0, 0.04);
            --pill-border: rgba(0, 0, 0, 0.08);
            --pill-text: rgba(31, 41, 55, 0.6);
            --grid-color: rgba(192, 57, 43, 0.04);
            --orb-opacity: 0.15;
            --campo-errore: #dc2626;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            min-height: 100vh;
            display: flex;
            background: var(--bg);
            color: var(--text);
            transition: background 0.4s ease, color 0.4s ease;
        }

        /* ===================== PANNELLO SINISTRO — Branding ===================== */
        .pannello-brand {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            padding: 60px;
            position: relative;
            overflow: hidden;
            background: var(--bg-brand);
            transition: background 0.4s ease;
        }

        /* Griglia animata sullo sfondo — rimossa */

        /* Cerchi decorativi con glow */
        .glow-orb {
            position: absolute;
            border-radius: 50%;
            filter: blur(80px);
            opacity: var(--orb-opacity);
            animation: orbFloat 15s ease-in-out infinite;
            transition: opacity 0.4s ease;
        }
        .glow-orb--1 {
            width: 350px; height: 350px;
            background: var(--primary);
            top: -10%; left: -5%;
        }
        .glow-orb--2 {
            width: 250px; height: 250px;
            background: #2563eb;
            bottom: -5%; right: -5%;
            animation-delay: -7s;
        }
        .glow-orb--3 {
            width: 180px; height: 180px;
            background: var(--primary-dark);
            top: 50%; left: 60%;
            animation-delay: -3s;
        }

        @keyframes orbFloat {
            0%, 100% { transform: translate(0, 0) scale(1); }
            33% { transform: translate(20px, -15px) scale(1.05); }
            66% { transform: translate(-10px, 10px) scale(0.95); }
        }

        .brand-contenuto {
            position: relative;
            z-index: 2;
            text-align: center;
            max-width: 420px;
        }

        .brand-logo {
            margin-bottom: 40px;
        }
        .brand-logo img {
            height: 56px;
            object-fit: contain;
            filter: drop-shadow(0 4px 12px rgba(192, 57, 43, 0.3));
        }

        .brand-titolo {
            font-size: 2.8rem;
            font-weight: 800;
            line-height: 1.1;
            margin-bottom: 16px;
            letter-spacing: -1.5px;
        }
        .brand-titolo span {
            background: linear-gradient(135deg, var(--primary) 0%, #e74c3c 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .brand-sottotitolo {
            font-size: 1.05rem;
            color: var(--text-muted);
            font-weight: 400;
            line-height: 1.6;
            margin-bottom: 48px;
        }

        /* Feature pills */
        .brand-features {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }
        .feature-pill {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 8px 16px;
            background: var(--pill-bg);
            border: 1px solid var(--pill-border);
            border-radius: 100px;
            font-size: 0.8rem;
            color: var(--pill-text);
            backdrop-filter: blur(8px);
            transition: background 0.3s, border-color 0.3s, color 0.3s;
        }
        .feature-pill i {
            color: var(--primary);
            font-size: 0.75rem;
        }

        /* ===================== PANNELLO DESTRO — Form ===================== */
        .pannello-form {
            width: 520px;
            min-width: 520px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px;
            position: relative;
        }

        /* Sfondo glass per il pannello destro */
        .pannello-form::before {
            content: '';
            position: absolute;
            inset: 12px;
            background: var(--glass-bg);
            backdrop-filter: blur(24px) saturate(180%);
            -webkit-backdrop-filter: blur(24px) saturate(180%);
            border: 1px solid var(--glass-border);
            border-radius: 24px;
            transition: background 0.4s ease, border-color 0.4s ease;
        }

        .form-wrapper {
            width: 100%;
            max-width: 380px;
            position: relative;
            z-index: 2;
        }

        .form-intestazione {
            margin-bottom: 36px;
        }
        .form-intestazione h2 {
            font-size: 1.6rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 8px;
        }
        .form-intestazione p {
            font-size: 0.9rem;
            color: var(--text-muted);
        }

        /* Form elements */
        .campo-gruppo {
            margin-bottom: 22px;
        }
        .campo-label {
            display: block;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text-label);
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .campo-wrapper {
            position: relative;
        }
        .campo-icona {
            position: absolute;
            left: 16px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--input-icon);
            font-size: 15px;
            transition: color 0.3s;
            pointer-events: none;
        }

        .campo-input {
            width: 100%;
            padding: 14px 16px 14px 48px;
            font-size: 0.95rem;
            font-family: inherit;
            background: var(--input-bg);
            border: 1px solid var(--input-border);
            border-radius: 12px;
            color: var(--text);
            outline: none;
            transition: all 0.3s ease;
        }
        .campo-input::placeholder {
            color: var(--input-placeholder);
        }
        .campo-input:hover {
            border-color: var(--input-hover-border);
            background: var(--input-hover-bg);
        }
        .campo-input:focus {
            border-color: var(--primary);
            background: rgba(192, 57, 43, 0.08);
            box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
        }
        .campo-input:focus ~ .campo-icona {
            color: var(--primary);
        }
        .campo-input.is-invalid {
            border-color: var(--danger);
        }
        .campo-input.is-invalid:focus {
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
        }

        .campo-errore {
            display: flex;
            align-items: center;
            gap: 6px;
            margin-top: 8px;
            font-size: 0.8rem;
            color: var(--campo-errore);
        }

        /* Opzioni form */
        .opzioni-form {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 28px;
            flex-wrap: wrap;
            gap: 12px;
        }
        .checkbox-ricordami {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
        }
        .checkbox-ricordami input[type="checkbox"] {
            width: 16px; height: 16px;
            accent-color: var(--primary);
            cursor: pointer;
        }
        .checkbox-ricordami span {
            font-size: 0.85rem;
            color: var(--checkbox-text);
        }
        .link-password {
            font-size: 0.85rem;
            color: var(--primary);
            text-decoration: none;
            font-weight: 500;
            transition: color 0.2s;
        }
        .link-password:hover {
            color: #e74c3c;
        }

        /* Bottone login */
        .btn-accedi {
            width: 100%;
            padding: 15px 24px;
            font-size: 0.95rem;
            font-weight: 600;
            font-family: inherit;
            color: var(--white);
            background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
            border: none;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            position: relative;
            overflow: hidden;
        }
        .btn-accedi::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .btn-accedi:hover::before { opacity: 1; }
        .btn-accedi:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(192, 57, 43, 0.5);
        }
        .btn-accedi:active { transform: translateY(0); }

        /* Footer */
        .form-footer {
            text-align: center;
            margin-top: 32px;
            padding-top: 24px;
            border-top: 1px solid var(--footer-border);
        }
        .form-footer p {
            font-size: 0.78rem;
            color: var(--text-footer);
        }
        .form-footer i { margin-right: 4px; }

        /* Password toggle */
        .btn-toggle-password {
            position: absolute;
            right: 14px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--input-icon);
            cursor: pointer;
            padding: 4px;
            transition: color 0.2s;
        }
        .btn-toggle-password:hover { color: var(--toggle-hover); }

        /* ===================== Toggle tema ===================== */
        .btn-toggle-tema {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 100;
            width: 42px;
            height: 42px;
            border-radius: 12px;
            border: 1px solid var(--glass-border);
            background: var(--input-bg);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            transition: all 0.3s ease;
        }
        .btn-toggle-tema:hover {
            background: var(--input-hover-bg);
            color: var(--primary);
            border-color: var(--primary);
        }

        /* Logo swap */
        .brand-logo .logo-dark { display: block; }
        .brand-logo .logo-light { display: none; }
        body.light-theme .brand-logo .logo-dark { display: none; }
        body.light-theme .brand-logo .logo-light { display: block; }

        /* Titolo light: testo scuro per la parte non-span */
        body.light-theme .brand-titolo { color: var(--text); }

        /* ===================== Animazione ingresso ===================== */
        @keyframes slideInSinistra {
            from { opacity: 0; transform: translateX(-40px); }
            to { opacity: 1; transform: translateX(0); }
        }
        @keyframes slideInDestra {
            from { opacity: 0; transform: translateX(40px); }
            to { opacity: 1; transform: translateX(0); }
        }
        .pannello-brand .brand-contenuto { animation: slideInSinistra 0.7s ease-out; }
        .pannello-form .form-wrapper { animation: slideInDestra 0.7s ease-out 0.15s both; }

        /* ===================== Responsive ===================== */
        @media (max-width: 960px) {
            body { flex-direction: column; }
            .pannello-brand {
                padding: 40px 30px 30px;
                min-height: auto;
            }
            .brand-titolo { font-size: 2rem; }
            .brand-sottotitolo { margin-bottom: 24px; font-size: 0.9rem; }
            .brand-features { display: none; }
            .pannello-form {
                width: 100%;
                min-width: unset;
                padding: 30px 20px 40px;
            }
            .pannello-form::before { inset: 0; border-radius: 24px 24px 0 0; }
            .btn-toggle-tema { top: 12px; right: 12px; width: 36px; height: 36px; font-size: 0.85rem; }
        }

        /* Alert status (password reset) */
        .auth-alert {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 12px 14px;
            border-radius: 12px;
            margin-bottom: 22px;
            font-size: 0.88rem;
            line-height: 1.45;
        }
        .auth-alert.success {
            background: rgba(34, 197, 94, 0.12);
            border: 1px solid rgba(34, 197, 94, 0.35);
            color: #4ade80;
        }
        body.light-theme .auth-alert.success {
            background: rgba(22, 163, 74, 0.1);
            border-color: rgba(22, 163, 74, 0.3);
            color: #15803d;
        }
        .auth-back {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            margin-top: 18px;
            font-size: 0.88rem;
            color: var(--text-muted);
            text-decoration: none;
            transition: color 0.2s;
        }
        .auth-back:hover { color: var(--primary); }
        .btn-accedi { color: var(--white, #fff); }


.campo-wrapper:has(.btn-toggle-password) .campo-input {
    padding-right: 44px;
}
