*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --navy-900: #0a0f1e;
    --navy-800: #111827;
    --navy-700: #1a2235;
    --navy-600: #243049;
    --navy-500: #2e3f5e;
    --teal-400: #2dd4bf;
    --teal-300: #5eead4;
    --teal-500: #14b8a6;
    --white: #ffffff;
    --gray-100: #f1f5f9;
    --gray-300: #94a3b8;
    --gray-400: #64748b;
    --gray-500: #475569;
    --red-400: #f87171;
    --green-400: #4ade80;
    --card-bg: rgba(17, 24, 39, 0.85);
    --border: rgba(45, 212, 191, 0.15);
    --border-hover: rgba(45, 212, 191, 0.4);
    --input-bg: rgba(10, 15, 30, 0.6);
    --radius: 12px;
    --radius-sm: 8px;
}

html, body {
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'DM Sans', sans-serif !important;
    background: var(--navy-900) !important;
    overflow: hidden !important;
}

#app {
    height: 100%;
}

/* === BACKGROUND === */
.bg {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 60% at 20% 10%, #1a2f5e 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 80% 90%, #0d2a3a 0%, transparent 60%), radial-gradient(ellipse 40% 40% at 50% 50%, #0f1e38 0%, transparent 80%), var(--navy-900);
    z-index: 0;
}

    .bg::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: linear-gradient(rgba(45,212,191,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(45,212,191,0.03) 1px, transparent 1px);
        background-size: 48px 48px;
    }

.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
    animation: floatOrb 12s ease-in-out infinite alternate;
    z-index: 0;
}

.orb-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
    background: rgba(14,116,144,0.18);
    animation-delay: 0s;
}

.orb-2 {
    width: 300px;
    height: 300px;
    bottom: -80px;
    right: -60px;
    background: rgba(45,212,191,0.12);
    animation-delay: -4s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    top: 60%;
    left: 70%;
    background: rgba(30,64,175,0.15);
    animation-delay: -8s;
}

@keyframes floatOrb {
    from {
        transform: translate(0,0) scale(1);
    }

    to {
        transform: translate(20px,30px) scale(1.08);
    }
}

/* === LAYOUT === */
.page {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 500px 1fr;
    /* FIX: centra verticalmente con justify-content */
    align-items: center;
    justify-items: center;
    padding: 0 20px;
}

/* === BRAND PANEL === */
.brand-panel {
    grid-column: 1;
    justify-self: start;
    padding: 0 20px 0 60px;
    animation: slideInLeft 0.8s cubic-bezier(0.16,1,0.3,1) forwards;
    opacity: 0;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 44px;
}

/* FIX: icona più grande e visibile */
.brand-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--teal-500), #0891b2);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(45,212,191,0.3), 0 8px 32px rgba(20,184,166,0.3);
}

    .brand-icon svg {
        width: 32px;
        height: 32px;
    }

/* FIX: brand name più grande */
.brand-name {
    font-family: 'DM Serif Display', serif;
    font-size: 26px;
    font-weight: 400;
    color: var(--white);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

    .brand-name span {
        color: var(--teal-400);
    }

.tagline {
    font-family: 'DM Serif Display', serif;
    font-size: 42px;
    line-height: 1.15;
    color: var(--white);
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

    .tagline em {
        font-style: italic;
        color: var(--teal-400);
    }

.tagline-sub {
    font-size: 15px;
    color: var(--gray-300);
    line-height: 1.65;
    max-width: 340px;
    margin-bottom: 48px;
}

.features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
}

    .feature-item:nth-child(1) {
        animation-delay: 0.4s;
    }

    .feature-item:nth-child(2) {
        animation-delay: 0.55s;
    }

    .feature-item:nth-child(3) {
        animation-delay: 0.7s;
    }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-dot {
    width: 8px;
    height: 8px;
    background: var(--teal-400);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--teal-400);
}

.feature-text {
    font-size: 14px;
    color: var(--gray-300);
}

/* === CARD === */
.card {
    grid-column: 2;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 44px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04) inset, 0 32px 80px rgba(0,0,0,0.5), 0 0 40px rgba(45,212,191,0.05);
    animation: slideInUp 0.7s cubic-bezier(0.16,1,0.3,1) 0.1s forwards;
    opacity: 0;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-header {
    margin-bottom: 36px;
}

.card-title {
    font-size: 26px;
    font-weight: 600;
    color: var(--white);
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 14px;
    color: var(--gray-400);
}

/* === FORM === */
.field {
    margin-bottom: 20px;
}

    .field label {
        display: block;
        font-size: 12px;
        font-weight: 500;
        color: var(--gray-300);
        letter-spacing: 0.06em;
        text-transform: uppercase;
        margin-bottom: 8px;
    }

.input-wrap {
    position: relative;
}

    .input-wrap input {
        width: 100%;
        background: var(--input-bg);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 13px 44px 13px 16px;
        font-family: 'DM Sans', sans-serif;
        font-size: 15px;
        color: var(--white);
        transition: border-color 0.2s, box-shadow 0.2s;
        outline: none;
    }

        .input-wrap input::placeholder {
            color: var(--gray-500);
        }

        .input-wrap input:focus {
            border-color: var(--teal-400);
            box-shadow: 0 0 0 3px rgba(45,212,191,0.12);
        }

        .input-wrap input:-webkit-autofill,
        .input-wrap input:-webkit-autofill:hover,
        .input-wrap input:-webkit-autofill:focus {
            -webkit-box-shadow: 0 0 0px 1000px #0d1525 inset;
            -webkit-text-fill-color: var(--white);
            transition: background-color 5000s ease-in-out 0s;
        }

.input-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

    .input-icon:hover {
        color: var(--teal-400);
    }

.field-error {
    display: block;
    font-size: 12px;
    color: var(--red-400);
    margin-top: 6px;
}

/* === CHECKBOX === */
.options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.check-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-hover);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

    .check-box.checked {
        background: var(--teal-500);
        border-color: var(--teal-500);
    }

.remember-label {
    font-size: 13px;
    color: var(--gray-300);
    user-select: none;
}

.forgot-link {
    font-size: 13px;
    color: var(--teal-400);
    text-decoration: none;
    transition: color 0.2s;
}

    .forgot-link:hover {
        color: var(--teal-300);
    }

/* === BUTTON === */
.btn-login {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--teal-500) 0%, #0891b2 100%);
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(20,184,166,0.3);
    letter-spacing: 0.01em;
}

    .btn-login::before {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg,rgba(255,255,255,0.15),transparent);
        opacity: 0;
        transition: opacity 0.2s;
    }

    .btn-login:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 28px rgba(20,184,166,0.4);
    }

        .btn-login:hover::before {
            opacity: 1;
        }

    .btn-login:active {
        transform: translateY(0);
    }

    .btn-login:disabled {
        opacity: 0.7;
        cursor: not-allowed;
        transform: none;
    }

    .btn-login .spinner {
        display: none;
        width: 18px;
        height: 18px;
        border: 2px solid rgba(255,255,255,0.3);
        border-top-color: white;
        border-radius: 50%;
        animation: spin 0.7s linear infinite;
        margin: 0 auto;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn-login.loading .btn-text {
    display: none;
}

.btn-login.loading .spinner {
    display: block;
}

/* === ALERT === */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease;
}

.alert-error {
    background: rgba(248,113,113,0.1);
    border: 1px solid rgba(248,113,113,0.25);
    color: var(--red-400);
}

.alert-info {
    background: rgba(45,212,191,0.08);
    border: 1px solid rgba(45,212,191,0.2);
    color: var(--teal-300);
}

/* === FOOTER === */
.card-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: var(--gray-500);
}

    .card-footer a {
        color: var(--teal-400);
        text-decoration: none;
    }

/* === VERSION BADGE === */
.version-badge {
    grid-column: 3;
    justify-self: start;
    align-self: end;
    padding: 0 0 40px 40px;
    animation: slideInLeft 0.8s cubic-bezier(0.16,1,0.3,1) 0.2s forwards;
    opacity: 0;
}

.v-label {
    font-size: 11px;
    color: var(--gray-500);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.v-number {
    font-family: 'DM Serif Display',serif;
    font-size: 15px;
    color: var(--gray-400);
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
    .page {
        grid-template-columns: 1fr 460px;
    }

    .brand-panel {
        padding-left: 30px;
    }

    .version-badge {
        display: none;
    }

    .tagline {
        font-size: 32px;
    }
}

@media (max-width: 760px) {
    .page {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 0 16px;
    }

    .brand-panel {
        display: none;
    }

    .card {
        width: 100%;
        max-width: 420px;
        padding: 36px 28px;
    }
}
