@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&display=swap');

:root {
    /* Palette HSL per colori più vibranti e profondi */
    --bg-app: #080a0f;
    --bg-surface: hsla(222, 25%, 10%, 0.7);
    --bg-surface-solid: #0f131a;
    --bg-surface-hover: hsla(222, 25%, 15%, 0.8);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: hsla(217, 33%, 17%, 0.5);
    
    --accent: #3b82f6;
    --accent-glow: hsla(217, 91%, 60%, 0.3);
    --accent-vibrant: #60a5fa;
    
    --danger: #ef4444;
    --danger-glow: hsla(0, 84%, 60%, 0.2);
    --success: #10b981;
    
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;
    
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --glass: blur(16px) saturate(180%);
    --shadow-premium: 0 10px 40px -10px rgba(0,0,0,0.5);
    
    --topbar-height: 80px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Nasconde scrollbar per Chrome, Safari e Opera */
*::-webkit-scrollbar {
    display: none;
}

body {
    background-color: var(--bg-app);
    background-image: 
        radial-gradient(circle at 0% 0%, hsla(217, 91%, 60%, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, hsla(0, 84%, 60%, 0.03) 0%, transparent 40%);
    color: var(--text-primary);
    font-family: var(--font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
    overflow-x: hidden;
    touch-action: manipulation; /* Rimuove ritardo 300ms e zoom accidentali */
}

/* Titoli Istituzionali (Cinzel) */
h1, h2, h3 {
    font-family: 'Cinzel', serif !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 700;
}

h1 { font-size: 1.8rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.4rem; margin-bottom: 0.8rem; }
h3 { font-size: 1.1rem; margin-bottom: 0.6rem; }


.mt-6 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

/* --- PREMIUM UTILITIES --- */
.hover-glow {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.hover-glow:hover {
    box-shadow: 0 0 20px var(--accent-glow, rgba(59, 130, 246, 0.4));
    border-color: var(--accent);
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
}

.hover-glow::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.hover-glow:hover::after {
    opacity: 1;
}


.premium-badge {
    background: linear-gradient(135deg, #FFD700, #F59E0B);
    color: #000;
    font-weight: 800;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* AUTH VIEW */
.auth-wrapper {
    display: flex;
    align-items: center; /* Default centrato */
    justify-content: center;
    min-height: 100dvh;
    min-height: 100vh; /* Fallback */
    background: radial-gradient(circle at center, var(--bg-surface-solid) 0%, var(--bg-app) 100%);
    padding: 1.5rem;
    overflow-y: auto; /* Abilita scroll se necessario */
}

/* Se il contenuto è troppo alto per lo schermo, allinea in alto invece di tagliare */
@media (max-height: 700px) {
    .auth-wrapper {
        align-items: flex-start;
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 3.5rem 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    border-top: 4px solid var(--accent);
    backdrop-filter: var(--glass);
    background: var(--bg-surface);
}
/* --- HOME COMPACTING & DISCLAIMER --- */
.home-disclaimer-bar {
    padding: 12px 15px;
    background: rgba(15, 19, 26, 0.8);
    border-top: 1px dashed var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
    backdrop-filter: blur(10px);
    margin-top: auto; /* Spinge il disclaimer in fondo al container flex */
    width: 100%;
}

.home-actions-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
    padding-bottom: 1rem;
}

.home-console.card {
    padding: 1rem !important;
    margin-bottom: 0.5rem !important;
}

.home-big-btn {
    padding: 1rem !important;
    margin-bottom: 0 !important;
}

.view-noscroll {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow-y: auto !important; /* Fallback: permette lo scroll se il contenuto eccede lo schermo */
    scrollbar-width: none; /* Nasconde la barra ma permette il movimento */
    -ms-overflow-style: none;
    justify-content: flex-start;
}

.view-noscroll::-webkit-scrollbar {
    display: none;
}

.view-scrollable {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}


.view-section {
    backdrop-filter: var(--glass);
    background: var(--bg-surface);
}

/* MOOD TRACKER & SFOGATOIO */
.mood-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.mood-btn {
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    filter: grayscale(100%);
    opacity: 0.5;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.mood-btn:active {
    transform: scale(0.9);
    filter: grayscale(0%);
    opacity: 1;
}

.mood-btn:hover {
    transform: scale(1.2) rotate(5deg);
    filter: grayscale(0%);
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.mood-btn.active {
    filter: grayscale(0%);
    opacity: 1;
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.25);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

.mood-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    border-left: 5px solid var(--danger);
    transition: transform 0.2s;
}

.mood-card:hover {
    transform: translateX(5px);
}

/* BUTTONS & ACCESSIBILITY */
.btn {
    min-height: 48px; /* Standard Apple/Google per touch target */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s cubic-bezier(0.17, 0.67, 0.83, 0.67), background 0.2s, box-shadow 0.2s;
    outline: none;
}

.btn:active {
    transform: scale(0.96);
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
    filter: brightness(1.1);
}

#btn-setup-next, #auth-submit-btn {
    min-height: 56px; /* Più grandi per il wizard */
    font-size: 1.1rem !important;
}

#btn-setup-next:active, #auth-submit-btn:active {
    transform: scale(0.95) translateY(2px);
}

#btn-reset-shift:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
    border-color: var(--danger) !important;
    transform: rotate(-30deg);
}

#btn-reset-shift:active {
    transform: scale(0.9);
}

/* MODALS */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    align-items: flex-start; /* Inizia sempre dall'alto per non tagliare il titolo */
    justify-content: center;
    padding: 20px 15px 100px 15px; /* Padding abbondante in fondo per superare il menu */
    overflow-y: auto; /* Rende il pop-up scorrevole */
    -webkit-overflow-scrolling: touch;
    transition: all 0.3s ease;
}

@media (max-width: 480px) {
    .modal {
        padding: 20px 10px 100px 10px !important; /* Spazio in alto e molto in basso per menu mobile */
        align-items: flex-start !important; /* Forza l'inizio dall'alto */
        justify-content: center !important;
    }
    .modal.active {
        display: flex !important;
    }
    .modal-content, .onboarding-card {
        width: 100% !important;
        max-width: 400px !important;
        max-height: 85vh !important;
        margin: auto !important; /* Torna a centrare i modal brevi (es. onboarding) */
        border-radius: 20px !important;
        padding: 1.5rem !important;
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important; /* RISOLTO: Ora tutto il pop-up scorre fluidamente */
        overflow-x: hidden !important;
    }

    /* Nuova classe specifica per moduli lunghi che devono partire dall'alto */
    .modal-content.modal-form-long {
        margin: 1.5rem auto 8rem auto !important;
        max-height: 90vh !important;
    }

    /* Classe per il Wizard "No-Scroll" a tutto schermo */
    .modal-content.modal-wizard-noscroll {
        width: 100% !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 1.5rem 1rem !important;
        overflow: hidden !important; /* Disabilita lo scroll globale */
        justify-content: flex-start !important;
    }
    
    /* Rimosso scroll frammentato dai singoli elementi per evitare tagli del titolo */
    .modal-content > div:not(.modal-footer-sticky), 
    .onboarding-card > p, 
    .modal-content p, 
    .modal-content form {
        overflow-y: visible; /* Rimosso !important per permettere override locali (es. TOS) */
        height: auto;
        margin-bottom: 10px !important;
        font-size: 0.9rem !important;
        line-height: 1.4 !important;
        width: 100% !important;
    }


    /* Titoli compatti */
    .modal-content h2, .modal-content h3, #onboarding-title {
        font-size: 1.2rem !important;
        margin: 0 0 10px 0 !important;
        flex-shrink: 0 !important;
    }

    /* Footer Pulsanti: Sempre visibile in fondo alla finestra */
    .onboarding-btns, .modal-footer-sticky {
        margin-top: auto !important;
        padding-top: 10px !important;
        display: flex !important;
        gap: 8px !important;
        flex-shrink: 0 !important;
        border-top: 1px solid var(--border);
    }

    .onboarding-icon {
        font-size: 2.8rem !important;
        margin-bottom: 0.5rem !important;
        flex-shrink: 0 !important;
    }

    .onboarding-dots {
        margin: 8px 0 !important;
        flex-shrink: 0 !important;
    }
}










@media (max-height: 700px) {
    .modal {
        padding-top: 1rem;
    }
}

/* Modale spostata più in alto (altezza occhi) - Disattivato per coerenza Full Screen Mobile */
#notary-nudge-modal.modal {
    /* align-items: flex-start; */
    /* padding-top: 10vh; */
}

.modal.active {
    display: flex;
    animation: modalFade 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 550px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 2.5rem;
    margin: 2rem auto; /* Centra orizzontalmente se il parent non è flex */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.modal-content::-webkit-scrollbar {
    display: none;
}

/* OTTIMIZZAZIONE MODAL PER MOBILE (FULL SCREEN) */
@media (max-width: 768px) {
    .modal {
        align-items: flex-start; /* Evita il taglio superiore su tablet/mobile */
        padding: 2rem 1rem 8rem 1rem;
    }

    .modal-content {
        width: 100%;
        height: auto;
        max-height: 92vh; /* Evita il taglio totale */
        border-radius: 16px;
        padding: 2rem 1.5rem;
        border: 1px solid var(--border);
    }
}

/* CATEGORY SELECTOR CARDS */
.category-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 6px;
    margin-top: 5px;
}

.cat-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cat-item:active {
    transform: scale(0.95);
    background: rgba(59, 130, 246, 0.2);
}

.cat-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.cat-item.active {
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.cat-item.active .cat-label {
    color: white;
}

.cat-icon {
    font-size: 1.2rem;
}

.cat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.2;
}

@media (max-width: 480px) {
    .category-selector-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* TASTO CHIUSURA MODAL */
.modal-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 1.8rem;
    line-height: 1;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .modal-close-btn {
        top: 1rem;
        right: 1rem;
        background: rgba(0, 0, 0, 0.2);
    }
}

/* PANIC BUTTON */
.btn-panic {
    display: none;
    /* Removed in favor of header SOS */
}

.sos-pill-btn {
    background: linear-gradient(135deg, var(--danger), #b91c1c);
    color: white !important;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-weight: 800;
    font-size: 0.85rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sos-pill-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.5);
}

/* LAYOUT BASE */
.app-container {
    display: flex !important;
    flex-direction: row;
    align-items: flex-start; /* Fondamentale: allinea tutto in alto */
    justify-content: flex-start;
    width: 100%;
    min-height: 100vh;
    position: relative;
    padding: 0 !important;
    margin: 0 !important;
}

.sidebar {
    width: 300px;
    background-color: var(--bg-surface-solid);
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.8rem 6rem; /* Aggiunto spazio in fondo per scroll mobile */
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100dvh;
    height: 100vh; /* Fallback */
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    z-index: 100;
    flex-shrink: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 3.5rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-primary);
    font-family: 'Cinzel', serif;
}

.nav-menu {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding-bottom: 2rem;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.2rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 1.5rem 0.5rem 0.8rem 0.5rem;
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 700;
    letter-spacing: 2px;
    opacity: 0.9;
    pointer-events: none;
    position: relative;
    padding-top: 1.2rem;
}

.nav-section-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 1px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: 0.5;
}

.nav-section-header::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow);
    display: inline-block;
}

/* Color variations for section dots */
.nav-section-header.header-diary::after { background: var(--success); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.nav-section-header.header-support::after { background: var(--accent); }
.nav-section-header.header-network::after { background: #8B5CF6; box-shadow: 0 0 8px rgba(139, 92, 246, 0.5); }
.nav-section-header.header-community::after { background: #F59E0B; box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

/* NEW PREMIUM ICONS */
.nav-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link:hover .nav-icon-container {
    transform: scale(1.1) rotate(3deg);
}

.ic-green { background: rgba(16, 185, 129, 0.1); color: var(--success) !important; border-color: rgba(16, 185, 129, 0.2); }
.ic-blue { background: rgba(59, 130, 246, 0.1); color: var(--accent) !important; border-color: rgba(59, 130, 246, 0.2); }
.ic-purple { background: rgba(139, 92, 246, 0.1); color: #8B5CF6 !important; border-color: rgba(139, 92, 246, 0.2); }
.ic-amber { background: rgba(245, 158, 11, 0.1); color: #F59E0B !important; border-color: rgba(245, 158, 11, 0.2); }
.ic-red { background: rgba(239, 68, 68, 0.1); color: var(--danger) !important; border-color: rgba(239, 68, 68, 0.2); }

.nav-link:hover .ic-green { background: rgba(16, 185, 129, 0.2); box-shadow: 0 0 15px rgba(16, 185, 129, 0.3); border-color: var(--success); }
.nav-link:hover .ic-blue { background: rgba(59, 130, 246, 0.2); box-shadow: 0 0 15px rgba(59, 130, 246, 0.3); border-color: var(--accent); }
.nav-link:hover .ic-purple { background: rgba(139, 92, 246, 0.2); box-shadow: 0 0 15px rgba(139, 92, 246, 0.3); border-color: #8B5CF6; }
.nav-link:hover .ic-amber { background: rgba(245, 158, 11, 0.2); box-shadow: 0 0 15px rgba(245, 158, 11, 0.3); border-color: #F59E0B; }
.nav-link:hover .ic-red { background: rgba(239, 68, 68, 0.2); box-shadow: 0 0 15px rgba(239, 68, 68, 0.3); border-color: var(--danger); }

.nav-icon-container svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.nav-link:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-link:active {
    transform: scale(0.98);
    background: var(--accent-glow);
}

.nav-link.active {
    background-color: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.main-content {
    display: block !important;
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
    padding-top: calc(var(--topbar-height) + 2rem) !important;
    padding-left: 3rem !important;
    padding-right: 3rem !important;
    padding-bottom: 5rem !important;
    position: relative;
    z-index: 1;
    box-sizing: border-box !important;
}

.typing-target {
    white-space: pre-wrap;
}

.view-section {
    display: none !important;
}

.view-section.active {
    display: block !important;
    padding: 0 1.2rem; /* Margine di sicurezza laterale standard */
}

@keyframes slideUpFade {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.section-header {
    margin-bottom: 3.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.section-header h1,
#section-timeline h1,
#section-union h1,
#section-rights h1,
#section-career h1,
#section-pills h1 {
    font-family: 'Cinzel', serif !important;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
}

.stats-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 700;
    backdrop-filter: var(--glass);
}

.card {
    background-color: var(--bg-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3.5rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

/* EVENT CARDS - DIARIO */
.event-card {
    background: var(--bg-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
}

.event-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--accent);
}

.event-date-badge {
    background: hsla(217, 91%, 60%, 0.1);
    color: var(--accent-vibrant);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: inline-block;
    margin-bottom: 0.8rem;
}

.event-type {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
}

.event-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.event-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.delete-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--danger);
    padding: 5px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background: hsla(0, 84%, 60%, 0.1);
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.9);
}

/* FORMS */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: var(--text-secondary);
}

input,
select,
textarea {
    width: 100%;
    background-color: hsla(222, 25%, 5%, 0.4);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 1.1rem 1.4rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background-color: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem 1.8rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    text-align: center;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 8px 25px -8px var(--accent);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.5);
}

.btn-outline {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

/* TIMELINE DIARY */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-top: 1rem;
}

.event-card {
    background-color: var(--bg-surface);
    backdrop-filter: var(--glass);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease;
}

.event-card:hover {
    transform: scale(1.01);
}

.event-card::before {
    content: '';
    position: absolute;
    left: -1px;
    top: 25px;
    bottom: 25px;
    width: 4px;
    background-color: var(--accent);
    border-radius: 0 4px 4px 0;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1.2rem;
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.event-date-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
}

.event-type {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-body p {
    color: var(--text-primary);
    font-size: 1.05rem;
    white-space: pre-line;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* ACTION HUB */
.action-hub {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.action-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--border);
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.action-card:hover {
    transform: translateY(-8px);
    background: var(--accent-glow);
    border-color: var(--accent);
}

.action-card i {
    font-size: 2.5rem;
}

/* BADGES */
.badge-container {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.badge-item {
    width: 60px;
    height: 60px;
    background: var(--bg-surface-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--border);
    opacity: 0.3;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.badge-item.unlocked {
    opacity: 1;
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(245, 158, 11, 0.1));
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.6), inset 0 0 15px rgba(255, 215, 0, 0.3);
    transform: scale(1.15);
    animation: goldPulse 2s infinite alternate;
}

@keyframes goldPulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.4), inset 0 0 10px rgba(255, 215, 0, 0.2);
    }

    100% {
        box-shadow: 0 0 35px rgba(255, 215, 0, 0.8), inset 0 0 20px rgba(255, 215, 0, 0.5);
    }
}

.badge-item::after {
    content: attr(data-name);
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    white-space: nowrap;
    color: var(--text-secondary);
    font-weight: bold;
}

/* HINT POPUP */
.hint-banner {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hint-banner i {
    font-size: 1.8rem;
    color: var(--accent);
}

/* REGISTRO ORE & SEMAFORO */
.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#rights-result {
    transition: all 0.5s ease;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shadow-glow {
    box-shadow: 0 0 15px var(--accent-glow);
}

.shadow-glow:hover {
    box-shadow: 0 0 25px var(--accent-glow);
    transform: translateY(-2px);
}

/* Medieval Font Class */

.medieval-font {
    font-family: 'Cinzel', serif;
    letter-spacing: 1.5px;
    font-weight: 800; /* Più imponente e autoritario */
    text-shadow: 0 1px 4px rgba(0,0,0,0.2); /* Ombra più sobria e professionale */
    color: #F1B221; /* Oro leggermente più caldo e metallico */
    text-transform: uppercase;
}

/* MOBILE RESPONSIVE OPTIMIZATION (Block 6) */

/* ═══════════════════════════════════════════════════════════════
   TOP-BAR FISSA (mobile + desktop)
═══════════════════════════════════════════════════════════════ */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;
    background: hsla(222, 25%, 5%, 0.65);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
    border-bottom: 1px solid var(--border);
    transition: all 0.3s ease;
}

.topbar-ticker-row {
    background: hsla(222, 25%, 5%, 0.95);
    border-bottom: 1px solid var(--border);
    padding: 8px 1rem;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    z-index: 9999;
    height: 34px;
    display: flex;
    align-items: center;
}

.topbar-main {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.back-btn {
    background: rgba(0,0,0,0.05); /* Effetto pulsante leggero */
    border: none;
    color: var(--text-primary);
    padding: 6px 12px 6px 8px;
    border-radius: 20px;
    margin-left: 5px;
    margin-right: 10px;
    cursor: pointer;
    display: none; /* Gestito da JS */
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.back-btn:active {
    transform: scale(0.9);
    opacity: 0.7;
}

@media (min-width: 769px) {
    .back-btn {
        /* Abilitato per coerenza navigazione anche su desktop */
        display: none; 
    }
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    cursor: pointer;
}

.topbar-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: #F59E0B;
    letter-spacing: 1.5px;
}

.topbar-icon {
    height: 36px;
    width: auto;
    filter: brightness(1.3) saturate(1.2) drop-shadow(0 0 8px rgba(245, 158, 11, 0.7)) drop-shadow(0 0 16px rgba(245, 158, 11, 0.35));
    transition: filter 0.3s ease;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* semaforo compatto nella top-bar */
.topbar-semaphore {
    display: flex;
    gap: 6px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.3s ease;
}

.topbar-semaphore:hover {
    background: rgba(255, 255, 255, 0.1);
}

.topbar-sem-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #334155;
    transition: background 0.4s, box-shadow 0.4s;
}

@keyframes semPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.sem-pulse {
    animation: semPulse 1.5s infinite;
}

/* hamburger button */
.hamburger-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-btn:active {
    background: rgba(255, 255, 255, 0.15);
}

/* overlay dietro la sidebar su mobile */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    z-index: 9099;
}

#sidebar-overlay.open {
    display: block;
}

@media (max-width: 768px) {
    .topbar {
        display: flex;
        flex-direction: column; /* Stack principale e ticker se attivo */
    }

    .topbar-main {
        padding: 0 1.1rem !important; /* Spazio visivo migliorato */
    }

    .topbar-text {
        font-size: 0.95rem !important; /* Più compatto per fare spazio al padding */
        letter-spacing: 0.3px !important;
    }

    .topbar-logo {
        margin-right: 5px; 
        gap: 4px; /* Logo più unito */
    }

    .hamburger-btn {
        margin-right: 0;
        flex-shrink: 0; /* Impedisce al pulsante di rimpicciolirsi */
    }

    .app-container {
        display: flex !important;
        flex-direction: column !important; /* Su mobile tornano in colonna */
        align-items: stretch !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(280px, 85vw);
        height: 100%;
        transform: translateX(-110%);
        transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 9200;
        padding: 60px 1.2rem 1.5rem;
        overflow-y: auto;
        box-shadow: none;
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.6);
    }

    .sidebar .logo {
        display: none;
    }

    /* nascosta: mostrata nella topbar */

    .main-content {
        padding-top: calc(var(--topbar-height) + 2rem) !important;
        padding-left: 0 !important; 
        padding-right: 0 !important;
        padding-bottom: 80px !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
        overflow-x: hidden; 
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-only-btn {
        display: none !important;
    }

    /* nav interna — non serve con topbar */

    .nav-link {
        padding: 0.9rem 1rem;
        font-size: 0.9rem;
        justify-content: flex-start;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.4rem;
    }

    .sidebar-footer {
        flex-direction: column;
        gap: 0.6rem;
        margin-top: 1.5rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
        margin-bottom: 2rem;
    }

    .section-header h1 {
        font-family: 'Cinzel', serif !important;
        font-size: 1.4rem;
        letter-spacing: 0.5px;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.92rem;
    }

    .card {
        padding: 1.1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .action-hub {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        max-width: 100%;
    }

    textarea {
        font-size: 16px !important;
    }

    #rights-table {
        overflow-x: auto;
    }

    table {
        min-width: 480px;
    }

    #union-chat-history,
    #career-chat-history {
        height: 55vh !important;
        max-height: 420px;
    }

    #live-earnings-bar {
        margin: 0 0 1.5rem 0; /* Rimossa trazione negativa ai bordi */
        border-radius: 12px;
    }

    .home-big-btn {
        padding: 1.2rem 1.4rem;
    }
}

@media (min-width: 769px) {
    .mobile-only-controls {
        display: none !important;
    }
}

/* Tasto Registra Evento Highlighting */
.nav-link-highlight {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    margin: 1rem 0.5rem !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.2);
    font-weight: 700 !important;
    border: none !important;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
}

.nav-link-highlight:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.nav-link-highlight:active {
    transform: translateY(1px) scale(0.98);
}

.nav-link-highlight .nav-icon-container {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
}

/* Bottom Nav Highlight (Mobile) - Allineato in riga */
.bottom-nav-highlight {
    position: relative;
    top: 0;
}

.bottom-nav-main-icon {
    width: 32px; /* Ridotto ulteriormente per integrazione perfetta */
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    border: none; /* Rimosso bordo spesso che faceva sporgere il tasto */
    transition: transform 0.2s;
}

.bottom-nav-highlight:active .bottom-nav-main-icon {
    transform: scale(0.9);
}

/* Epic IA Loading Indicator */
.typing-indicator-epic {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

.epic-loader-ring {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.epic-loader-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.epic-loader-text::after {
    content: '...';
    display: inline-block;
    width: 12px;
    text-align: left;
    animation: dots 1.5s infinite;
}

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

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* Bottom Navigation Bar */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 75px; /* Altezza ottimizzata */
    padding-bottom: env(safe-area-inset-bottom);
    background: #0f172a;
    border-top: 1px solid var(--border);
    z-index: 9500;
    justify-content: space-around;
    align-items: center; /* Centra tutto verticalmente */
    padding-top: 0;
}

.bottom-nav-item {
    display: flex;
    flex: 1; /* Distribuisce lo spazio in modo equo tra tutti i tasti */
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px; /* Ridotto leggermente per evitare sovrapposizioni */
    gap: 6px;
    padding: 0 2px;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 0; /* Previene overflow del flex item */
}

.bottom-nav-item span {
    white-space: nowrap;
}

.bottom-nav-item.active {
    color: var(--accent);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
    
    .sidebar-footer .btn {
        width: 100%;
        flex: 1;
        min-width: 140px;
        padding: 0.8rem;
    }

    .mobile-only-btn {
        display: inline-flex;
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 2rem;
        background: rgba(59, 130, 246, 0.1);
        border: 1px solid rgba(59, 130, 246, 0.4);
        color: var(--accent);
        border-radius: 12px;
        padding: 1.2rem;
        font-weight: 800;
        font-size: 1.05rem;
    }

    .mobile-only {
        display: block !important;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
        margin-bottom: 2rem;
    }

    .section-header h1 {
        font-family: 'Cinzel', serif !important;
        font-size: 1.4rem;
        letter-spacing: 0.5px;
        line-height: 1.3;
    }

    .subtitle {
        font-size: 0.95rem;
    }

    .card {
        padding: 1.2rem;
    }

    #union-chat-history,
    #career-chat-history,
    #ai-chat-history {
        height: 70dvh !important;
        max-height: none !important;
    }

    textarea {
        font-size: 16px !important;
        /* Evita zoom automatico su iOS */
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .action-hub {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
        max-width: 100%;
    }

    .btn-panic {
        top: auto;
        bottom: 1.5rem;
        right: 1.5rem;
        font-size: 0.8rem;
        padding: 0.8rem 1rem;
        z-index: 9999;
    }

    .auth-card {
        padding: 2.5rem 1.5rem;
        margin: 1rem;
    }

    .features-overview li {
        font-size: 0.85rem;
    }

    /* Ridimensiona tabelle per evitare overflow orizzontale */
    #rights-table {
        overflow-x: auto;
    }

    table {
        min-width: 500px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   HOME LAYOUT — 3 GRANDI TASTI
═══════════════════════════════════════════════════════════════ */
.home-actions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
    max-width: 500px;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    margin-top: 0;
    margin-bottom: 2rem;
    box-sizing: border-box;
}

.home-big-btn {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.8rem 2rem;
    border-radius: 24px;
    font-weight: 800;
    font-size: 1.25rem;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: inherit;
    text-align: left;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.home-big-btn:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
}

.home-big-btn:active {
    transform: scale(0.97);
}

.home-big-btn .btn-icon {
    font-size: 3rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.home-big-btn:hover .btn-icon {
    transform: scale(1.1) rotate(5deg);
}

.home-big-btn .btn-label {
    display: flex;
    flex-direction: column;
}

.home-big-btn .btn-title {
    font-family: 'Cinzel', serif !important;
    font-size: 1.35rem; /* Ridotto leggermente per far stare tutto su una riga con Cinzel */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-sub {
    display: block;
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.8;
    margin-top: 5px;
    letter-spacing: 0.3px;
    line-height: 1.3;
}

.home-big-btn.btn-shift {
    background: linear-gradient(145deg, #059669, #10b981);
    color: #fff;
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.3);
}

.home-big-btn.btn-shift:hover {
    box-shadow: 0 20px 45px rgba(16, 185, 129, 0.5);
}

.home-big-btn.btn-diary {
    background: linear-gradient(145deg, #2563eb, #3b82f6);
    color: #fff;
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.3);
}

.home-big-btn.btn-diary:hover {
    box-shadow: 0 20px 45px rgba(59, 130, 246, 0.5);
}

.home-big-btn.btn-ai {
    background: linear-gradient(145deg, #7c3aed, #8b5cf6);
    color: #fff;
    box-shadow: 0 15px 35px rgba(139, 92, 246, 0.3);
}

.home-big-btn.btn-ai:hover {
    box-shadow: 0 20px 45px rgba(139, 92, 246, 0.5);
}

/* Counters in Home Big Button */
#shift-active-content {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#home-live-amount {
    text-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    letter-spacing: -1px;
}

/* ═══════════════════════════════════════════════════════════════
   LIVE EARNINGS BAR
═══════════════════════════════════════════════════════════════ */
#live-earnings-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 9400;
    background: linear-gradient(90deg, #14532d, #15803d, #16a34a);
    padding: 0.8rem 1.5rem;
    border-radius: 0 0 16px 16px;
    margin: -3.5rem -3.5rem 2rem -3.5rem;
    border-bottom: 2px solid rgba(34, 197, 94, 0.5);
}

#live-earnings-bar.show {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    animation: pulseBar 2s ease-in-out infinite;
}

@keyframes pulseBar {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(22, 163, 74, 0.3);
    }

    50% {
        box-shadow: 0 4px 30px rgba(22, 163, 74, 0.6);
    }
}

.live-bar-amount {
    font-size: 1.8rem;
    font-weight: 900;
    color: #fff;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.live-bar-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}

.live-bar-timer {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-family: monospace;
}

.live-bar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.live-bar-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.live-bar-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.live-bar-btn.btn-stop {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.live-bar-btn.btn-stop:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* MAGGIORAZIONI TOGGLE */
.majorations-row {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
}

.majoration-badge {
    padding: 0.35rem 0.9rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
    user-select: none;
}

.majoration-badge.active {
    background: rgba(245, 158, 11, 0.25);
    border-color: #F59E0B;
    color: #FCD34D;
}

/* ═══════════════════════════════════════════════════════════════
   DRAWER MENU SECONDARIO ☰
═══════════════════════════════════════════════════════════════ */
#secondary-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9000;
}

#secondary-menu-overlay.open {
    display: block;
}

#secondary-menu {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(360px, 90vw);
    background: #0f1520;
    border-left: 1px solid var(--border);
    z-index: 9001;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5rem; /* Spazio extra per evitare tagli su mobile */
    box-shadow: -20px 0 40px rgba(0, 0, 0, 0.5);
}

#secondary-menu.open {
    transform: translateX(0);
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-decoration: none;
}

.drawer-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(-4px);
}

.drawer-sep {
    height: 1px;
    background: var(--border);
    margin: 0.4rem 0;
}

.drawer-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--text-secondary);
    font-weight: 700;
    padding: 0.5rem 0.5rem 0;
    font-family: 'Cinzel', serif;
}

/* HOME HEADER BAR */
.home-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.8rem;
}

.home-header-bar h1 {
    font-family: 'Cinzel', serif !important;
    font-size: 1.6rem;
    font-weight: 800;
}

.menu-trigger-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-trigger-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* HOME SOS FOOTER */
.home-sos-footer {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: 1rem 1.2rem;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 14px;
    align-items: center;
    justify-content: center;
}

.sos-link {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.sos-link:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* MOOD BOTTOM SUMMARY */
.mood-bottom-summary {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: var(--glass);
}

.mood-mini-indicators {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.mood-dot {
    font-size: 1.2rem;
    opacity: 0.4;
    cursor: pointer;
    transition: all 0.2s;
    filter: grayscale(1);
}

.mood-dot.active {
    opacity: 1;
    transform: scale(1.3);
    filter: grayscale(0);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.mood-emoji-more {
    display: none;
}

.mood-emoji-more.expanded {
    display: contents;
}

.expand-emoji-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 64px;
    height: 64px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.expand-emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* IA CHAT AUTO HEIGHT & STYLING — WHATSAPP OVERHAUL */
.chat-view-container {
    display: flex;
    flex-direction: column;
    height: 75dvh;
    background-color: #e5ddd5; /* WhatsApp beige background */
    background-image: url("https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png"); /* Subtle doodle pattern */
    background-repeat: repeat;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 2rem;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.chat-view-header {
    background-color: #075e54; /* WhatsApp dark teal */
    padding: 6px 16px; /* Compattato */
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    z-index: 10;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background-color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-avatar.union { border: 2px solid var(--success); }
.chat-avatar.career { border: 2px solid var(--accent); }

.chat-header-info {
    flex-grow: 1;
}

.chat-header-name {
    font-weight: 700;
    font-size: 1rem;
}

.chat-header-status {
    font-size: 0.75rem;
    opacity: 0.8;
}

.chat-view-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 12px 16px 80px 16px; /* Aumentato padding-bottom per evitare coperture del footer */
    display: flex;
    flex-direction: column;
    gap: 8px; /* Ridotto gap tra bolle */
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.chat-view-footer {
    background-color: #f0f0f0;
    padding: 8px 16px 16px 16px; /* Più compatto sotto */
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 9200; /* Sopra la bottom-nav */
}

.chat-typing-status {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 5px;
    font-style: italic;
    height: 1.2rem;
}

.chat-typing-status span {
    animation: typing-dots 1.5s infinite;
}
.chat-typing-status span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-status span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-dots {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.chat-input-row {
    display: flex;
    gap: 12px; /* Più spazio tra input e tasto invio */
    align-items: center;
}

.chat-input-row input {
    flex-grow: 1;
    background: white !important;
    border: 1px solid rgba(0,0,0,0.1) !important; /* Bordino sottilissimo per definizione */
    border-radius: 24px !important; /* Più arrotondato */
    padding: 12px 18px !important; /* Testo più arioso */
    color: #333 !important;
    font-size: 1rem !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    background-color: #075e54;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-send-btn:active {
    transform: scale(0.9);
}

.chat-bubble {
    padding: 8px 12px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 0.95rem;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    animation: bubbleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    color: #303030 !important;
}

/* Stili per formattazione IA avanzata */
.ai-h3 { font-size: 1.1rem; margin: 10px 0 5px 0; color: var(--accent); border-bottom: 1px solid var(--border); padding-bottom: 3px; }
.ai-h4 { font-size: 1rem; margin: 8px 0 4px 0; color: var(--text-primary); font-weight: bold; }
.ai-ul { margin: 8px 0; padding-left: 1.2rem; }
.ai-ul li { margin-bottom: 4px; }

.ai-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.85rem; background: rgba(0,0,0,0.05); border-radius: 8px; overflow: hidden; }
.ai-table td { padding: 8px; border: 1px solid rgba(0,0,0,0.1); }
.ai-table tr:first-child { background: rgba(0,0,0,0.1); font-weight: bold; }

.chat-bubble.user {
    align-self: flex-end;
    background-color: #dcf8c6 !important;
    border-radius: 10px 0 10px 10px;
}

.chat-bubble.user::after {
    content: "";
    position: absolute;
    top: 0;
    right: -10px;
    width: 0;
    height: 0;
    border-left: 10px solid #dcf8c6;
    border-bottom: 10px solid transparent;
}

.chat-bubble.ai {
    align-self: flex-start;
    background-color: #ffffff !important;
    border-radius: 0 10px 10px 10px;
    border: none !important;
}

.chat-bubble.ai::after {
    content: "";
    position: absolute;
    top: 0;
    left: -10px;
    width: 0;
    height: 0;
    border-right: 10px solid #ffffff;
    border-bottom: 10px solid transparent;
}

.chat-bubble.ai.union { border-left: none !important; }
.chat-bubble.ai.career { border-left: none !important; }

.ia-res-name {
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    display: block;
}

.ia-res-name.union {
    color: var(--success);
}

.ia-res-name.career {
    color: #F59E0B;
}

/* Markdown-ish formatting in chat */
.ia-res strong {
    color: var(--accent);
    font-weight: 700;
}

.ia-res ul,
.ia-res ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.ia-res li {
    margin-bottom: 0.5rem;
}

/* BETA BADGE STYLES */
.beta-badge {
    background: linear-gradient(135deg, #8B5CF6, #6366F1);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
}

.beta-badge:hover {
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.5);
    background: linear-gradient(135deg, #a78bfa, #818cf8);
}

.beta-badge::after {
    content: " 📝";
    font-size: 0.7rem;
    margin-left: 4px;
}

/* Typing animation */
.typing-container {
    display: flex;
    gap: 4px;
    padding: 10px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingPulse 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* MODERN SPINNER */
.modern-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-left-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 1s linear infinite;
}

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

/* TOAST */
.toast-container {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    background: rgba(15, 21, 32, 0.95);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.7rem 1.3rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    backdrop-filter: blur(12px);
    animation: toastIn 0.3s ease, toastOut 0.4s ease 2.5s forwards;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    white-space: normal;
    max-width: 90vw;
    text-align: center;
    line-height: 1.4;
}

.toast.success {
    background: rgba(16, 185, 129, 0.9);
    border-color: var(--success);
}

.toast.error {
    background: rgba(239, 68, 68, 0.9);
    border-color: var(--danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* SHIFT SUMMARY MODAL */
#shift-summary-modal .summary-big {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--clr-earnings);
    font-variant-numeric: tabular-nums;
    text-align: center;
    margin: 1rem 0;
    text-shadow: 0 0 30px var(--clr-earnings-glow);
}

#shift-summary-modal .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

#wage-setup-modal .wage-preview {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--clr-earnings);
    text-align: center;
    min-height: 2.2rem;
    margin: 0.5rem 0;
}

/* STATUS PILL */
.home-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.home-status-pill.idle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.home-status-pill.active {
    background: rgba(22, 163, 74, 0.15);
    border: 1px solid rgba(22, 163, 74, 0.4);
    color: #86efac;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.home-status-pill.active .status-dot {
    animation: dotBlink 1s step-end infinite;
}

@keyframes dotBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* MOBILE */
@media (max-width:768px) {
    .btn {
        padding: 14px 20px;
        font-size: 1rem;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .calendar-card {
        order: -1;
        margin-bottom: 20px;
    }

    #live-earnings-bar {
        margin: 0 0 1.5rem 0;
        border-radius: 12px;
    }

    .home-big-btn {
        padding: 1.2rem 1.4rem;
    }

    #secondary-menu {
        width: min(300px, 92vw);
    }
}

/* Nuovi stili cassetto SPA Mobile */
.mobile-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100%;
    height: 100dvh; /* Supporto browser moderni anti-taglio */
    background: var(--bg-surface-solid);
    box-shadow: -5px 0 25px rgba(0,0,0,0.5);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#sidebar-overlay.open .mobile-drawer {
    transform: translateX(0);
}

.mobile-drawer .nav-menu {
    padding: 1rem;
    flex-grow: 1;
}

.mobile-drawer .sidebar-footer {
    padding: 1.5rem 1.5rem 6rem; /* Spazio extra per tasto Esci e Blocca */
    border-top: 1px solid var(--border);
}

.mobile-drawer .logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}


/* Ticker Scorrevole (Marquee) */
.topbar-ticker-row {
    flex-shrink: 0;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    height: 28px;
    display: none; /* Inizialmente nascosto */
    align-items: center;
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.2), rgba(0, 0, 0, 0.4), rgba(239, 68, 68, 0.2));
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    animation: slideDownTicker 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownTicker {
    from { height: 0; opacity: 0; }
    to { height: 28px; opacity: 1; }
}

.ticker-text {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-scroll 25s linear infinite;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* Rimosso hidden-by-ticker per stabilità layout */

/* --- Dashboard Status Semaphore (Modern & Light) --- */
.status-bar-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0 auto 1.5rem auto;
    max-width: fit-content;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.status-bar-pill.status-green {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.08);
    color: #10B981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
}

.status-bar-pill.status-orange {
    border-color: rgba(245, 158, 11, 0.4);
    background: rgba(245, 158, 11, 0.08);
    color: #F59E0B;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1);
}

.status-bar-pill.status-red {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.08);
    color: #EF4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
    animation: glowPulseRed 2s infinite alternate;
}

@keyframes glowPulseRed {
    from { box-shadow: 0 0 10px rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }
    to { box-shadow: 0 0 25px rgba(239, 68, 68, 0.4); border-color: rgba(239, 68, 68, 0.6); }
}

.status-bar-pill .status-icon {
    font-size: 1.1rem;
}

@media (max-width: 480px) {
    .status-bar-pill {
        width: 90%;
        font-size: 0.75rem;
        padding: 0.6rem 1rem;
    }
}

/* --- Enhanced Status Pill (Solid & Integrated) --- */
.status-bar-pill.solid-integrated {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
    padding: 0.8rem 2rem;
    font-size: 0.9rem;
    width: 100%;
    max-width: none;
    border-radius: 12px;
}

.status-bar-pill.solid-integrated.status-green {
    background: rgba(16, 185, 129, 0.15);
    border-color: #10B981;
    color: #10B981;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2), inset 0 0 10px rgba(16, 185, 129, 0.1);
}

.status-bar-pill.solid-integrated.status-orange {
    background: rgba(245, 158, 11, 0.15);
    border-color: #F59E0B;
    color: #F59E0B;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2), inset 0 0 10px rgba(245, 158, 11, 0.1);
}

.status-bar-pill.solid-integrated.status-red {
    background: rgba(239, 68, 68, 0.2);
    border-color: #EF4444;
    color: #EF4444;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.4), inset 0 0 15px rgba(239, 68, 68, 0.2);
}

/* ── ADMIN DASHBOARD STYLES ──────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border: 1px solid rgba(255,255,255,0.1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.stat-value {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* 🔒 Blocchi di Integrità e Metadati (Digital Forensics Look) */
.event-integrity-block {
    margin-top: 1.25rem;
    padding: 1.25rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px dashed rgba(16, 185, 129, 0.3);
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
}

.integrity-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    color: #10B981;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 1px;
}

.hash-container {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1rem;
}

.hash-label {
    display: block;
    font-size: 0.65rem;
    margin-bottom: 4px;
    opacity: 0.5;
}

.hash-code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    word-break: break-all;
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 0.85rem;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 1rem;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.metadata-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.4;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
}
/* GPS LINK IN TIMELINE */
.event-gps-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-radius: 8px;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.event-gps-link:hover {
    background: var(--success);
    color: #0b0e14;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* LEGAL DISCLAIMER & WAIVER STYLES */
.disclaimer-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
    font-style: italic;
    text-align: justify;
}

.legal-warning-box {
    background: rgba(239, 68, 68, 0.05);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--danger);
    line-height: 1.4;
}

.legal-warning-box strong {
    text-transform: uppercase;
    display: block;
    margin-bottom: 4px;
}

/* 🤖 AI STREAMING & CHAT STYLES */
.typing-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background-color: var(--accent);
    margin-left: 4px;
    animation: blinkCursor 0.8s infinite;
    vertical-align: middle;
    border-radius: 2px;
}

@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}


.ia-res {
    line-height: 1.6;
    word-wrap: break-word;
}

/* Chat container immersive layout - ONLY when active */
.view-section.chat-immersive.active {
    position: fixed !important;
    top: var(--topbar-height) !important; /* Allineato all'altezza dinamica della topbar */
    left: 0;
    right: 0;
    bottom: 80px; /* Deve combaciare con h della barra su mobile */
    z-index: 8500;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column;
    height: auto !important; 
    width: 100vw !important;
    max-width: 100vw !important;
    background: #e5ddd5; 
    overflow-y: auto;
    transform: none !important; 
    animation: none !important;
}

/* Correzione per ticker attivo: sposta la chat in basso di 34px (altezza ticker) */
.ticker-active .view-section.chat-immersive.active {
    top: calc(var(--topbar-height) + 34px) !important;
}

@media (min-width: 769px) {
    .view-section.chat-immersive {
        bottom: 0px; /* Su desktop non c'è bottom-nav fissa allo stesso modo o è diversa */
    }
}

@media (max-width: 768px) {
    .view-section.chat-immersive {
        bottom: 80px; /* Deve combaciare con h della barra */
        padding-bottom: env(safe-area-inset-bottom);
    }
}

.view-section.active.chat-immersive .section-header {
    display: none !important;
}

.view-section.active.chat-immersive .chat-view-container {
    height: 100%;
    max-height: none;
    margin-top: 0;
    margin-bottom: 0; /* Remove the 2rem bottom margin */
    border-radius: 0;
    border: none; /* Remove border in full screen */
    box-shadow: none; /* Remove shadow */
    flex: 1;
    display: flex;
    flex-direction: column;
}

#union-chat-history, #career-chat-history {
    scroll-behavior: smooth;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
}

.chat-bubble {
    max-width: 85%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
}


/* --- JONAH BERGER 6 PILLAR COMPONENTS --- */
.public-proof-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.public-proof-counter {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 50px;
    padding: 0.6rem 1.4rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 700;
    backdrop-filter: blur(5px);
}

.counter-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--success);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(1); opacity: 1; box-shadow: 0 0 5px var(--success); }
    50% { transform: scale(1.3); opacity: 0.7; box-shadow: 0 0 15px var(--success); }
    100% { transform: scale(1); opacity: 1; box-shadow: 0 0 5px var(--success); }
}

.pills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.pill-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    overflow: hidden;
}

.pill-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    opacity: 0.5;
}

.pill-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.pill-icon {
    font-size: 2.22rem;
    margin-bottom: 0.5rem;
}

.pill-tag {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
    width: fit-content;
    letter-spacing: 0.5px;
}

.pill-tag.legale { background: rgba(59, 130, 246, 0.1); color: var(--accent); }
.pill-tag.career { background: rgba(245, 158, 11, 0.1); color: #F59E0B; }
.pill-tag.union { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.pill-actions {
    margin-top: auto;
    display: flex;
    gap: 10px;
}

.btn-pill-action {
    flex: 1;
    padding: 0.7rem;
    font-size: 0.8rem;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
}

.btn-pill-action:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* MISSION & STORY SECTION */
.mission-hero {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9)), url('Guerriero 2.jpg');
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 3rem 2rem;
    border-radius: 24px;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.mission-hero h2 {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: #F59E0B;
    margin-bottom: 1.5rem;
}

.mission-text {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    opacity: 0.9;
}

.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.story-card {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: 16px;
    border-top: 4px solid var(--accent);
}

.story-card h4 {
    color: var(--accent);
    margin-bottom: 1rem;
}

/* --- MODERN SWITCH TOGGLE --- */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255,255,255,0.1);
    transition: .4s;
    border-radius: 24px;
    border: 1px solid var(--border);
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider-toggle {
    background-color: var(--accent);
    border-color: var(--accent);
}

input:checked + .slider-toggle:before {
    transform: translateX(20px);
}

/* ═══════════════════════════════════════════════════════════════
   ONBOARDING & WELCOME CARD
═══════════════════════════════════════════════════════════════ */
.welcome-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.08));
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--accent);
    padding: 1.2rem 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    position: relative;
    animation: slideInDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@keyframes slideInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-card h3 {
    color: var(--accent);
    font-size: 1.1rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.welcome-card p {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin: 0;
}

.welcome-card .btn-close-welcome {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.welcome-card .btn-close-welcome:hover {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   ONBOARDING TOUR — MODAL CARD APPROACH (100% AFFIDABILE)
═══════════════════════════════════════════════════════════════ */
.onboarding-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
}

.onboarding-modal.active {
    display: flex;
}

.onboarding-card {
    background: linear-gradient(160deg, #1a1f35 0%, #0f172a 100%);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 380px;
    max-height: 85vh;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    text-align: center;
    position: relative;
    animation: cardSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(59, 130, 246, 0.15);
}

.onboarding-card::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}



/* ═══════════════════════════════════════════════════════════════
   SMART STATUS BANNER & SHIELD RING
   ═══════════════════════════════════════════════════════════════ */
.smart-status-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1.2rem;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    animation: slideDownFade 0.6s ease;
    position: relative;
    overflow: hidden;
}

.shield-ring-container {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shield-ring-svg {
    position: absolute;
    top: 0; left: 0;
    transform: rotate(-90deg);
}

.shield-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.shield-ring-progress {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out, stroke 0.5s ease;
}

.shield-ring-icon {
    font-size: 1.2rem;
    z-index: 1;
}

.pill-ticker-container {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.pill-ticker-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--accent);
    letter-spacing: 0.5px;
    margin-bottom: 2px;
    opacity: 0.8;
}

.pill-ticker-text {
    font-size: 0.82rem;
    line-height: 1.25;
    color: var(--text-primary);
    white-space: normal; /* Permette il wrap su mobile */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Limita a due righe per non eccedere in altezza */
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: opacity 0.4s ease-in-out;
}

.pill-ticker-text.fade-out {
    opacity: 0;
}

.shield-percent-compact {
    font-family: var(--font); /* Usiamo il font moderno dell'app */
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin-top: -1px;
    letter-spacing: -0.2px;
}

/* ONBOARDING CHECKLIST */
.checklist-card {
    animation: slideDownFade 0.6s ease-out;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 0.8rem;
    padding: 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.checklist-item.completed {
    opacity: 0.6;
    background: rgba(16, 185, 129, 0.05);
}

.checklist-item.completed .chk-status {
    color: var(--success);
    font-weight: 900;
}

.checklist-item.completed .chk-text {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.chk-status {
    font-family: monospace;
    font-size: 1.2rem;
    color: var(--accent);
    min-width: 20px;
}

.chk-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}


/* --- CONSOLE SETTINGS SMOOTH TRANSITION --- */
.console-settings {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-bottom: 0;
    padding: 0 1.2rem;
    background: rgba(0,0,0,0.3);
    border-radius: 12px;
    border: 1px solid rgba(16,185,129,0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.console-settings.open {
    max-height: 500px; /* Valore sufficiente per il contenuto */
    opacity: 1;
    padding: 1.2rem;
    margin-bottom: 1.5rem;
    pointer-events: auto;
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes cardSlideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-icon {
    font-size: 4rem;
    margin-bottom: 1.2rem;
    display: block;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.onboarding-card h3 {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
}

.onboarding-card p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.onboarding-step-counter {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.onboarding-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 2rem;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.onboarding-dot.active {
    background: var(--accent);
    width: 24px;
    border-radius: 4px;
}

.onboarding-btns {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.onboarding-btns .btn {
    min-width: 120px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 12px;
}

/* NOTARIZZAZIONE & SCUDO TEMPORALE */
.shadow-glow {
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
    transition: all 0.3s ease;
}

.shadow-glow:hover {
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.6);
    transform: translateY(-2px);
}

.badge-notarized {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.notary-nudge-modal .modal-content {
    border-top: 5px solid var(--accent);
}

/* Medieval Font utility (Cinzel fallback) */
.medieval-font {
    font-family: 'Cinzel', serif;
    letter-spacing: 1px;
}

/* PULSANTE RELAZIONE TECNICA */
.btn-report {
    background: rgba(59, 130, 246, 0.05);
    color: var(--accent);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(10px);
}

.btn-report:hover {
    background: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
    border-color: var(--accent);
}

.btn-report svg {
    opacity: 1;
    transition: transform 0.3s ease;
}

.btn-report:hover svg {
    transform: translateX(3px) scale(1.1);
}


/* 🛡️ SECURITY NUDGE & PDF EXPORT STYLES */
.security-nudge {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    animation: slideUpFade 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.security-nudge::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #3B82F6, #60A5FA, #3B82F6);
    animation: flowLight 3s linear infinite;
}

.security-nudge h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #60A5FA;
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.security-nudge p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.nudge-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-nudge-export {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #000;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.btn-nudge-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
    filter: brightness(1.1);
}

.btn-nudge-dismiss {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nudge-dismiss:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes flowLight {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* --- SKELETON LOADERS (Perceived Performance) --- */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.media-loader-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px dashed var(--border);
    border-radius: 8px;
    margin-top: 10px;
    font-size: 1.2rem;
    cursor: wait;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: rgba(255,255,255,0.02);
    border-radius: 20px;
    border: 1px dashed var(--border);
    margin-top: 2rem;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION BAR (Premium Mobile)
   ═══════════════════════════════════════════════════════════════ */
.bottom-nav {
    display: none; /* Nascosta su Desktop */
    position: fixed;
    bottom: 1.2rem;
    left: 1.2rem;
    right: 1.2rem;
    height: 70px;
    background: rgba(10, 15, 25, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 15px 45px rgba(0,0,0,0.6);
    padding: 0 0.8rem;
}

.bottom-nav .nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    height: 100%;
    position: relative;
    opacity: 0.7;
}

.bottom-nav .nav-link svg {
    width: 22px;
    height: 22px;
    transition: all 0.3s ease;
}

.bottom-nav .nav-link.active {
    color: var(--accent);
    opacity: 1;
}

/* Indicatore attivo premium */
.bottom-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-glow);
}

.bottom-nav .nav-link.active svg {
    transform: translateY(-4px);
    filter: drop-shadow(0 0 12px var(--accent-glow));
}

/* FLOATING ACTION BUTTON (FAB) - Forza Visibilità */
.fab-add-event {
    position: fixed;
    bottom: 125px; /* Alzato per evitare sovrapposizioni */
    right: 20px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    border-radius: 50%;
    display: none; /* Cambiato da opacity 0 a display none */
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.6);
    z-index: 99999; /* Massima priorità */
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid rgba(255,255,255,0.2);
    color: white;
}

.fab-add-event.visible {
    display: flex !important;
    animation: fabAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes fabAppear {
    from { opacity: 0; transform: scale(0.5) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.fab-add-event:active {
    transform: scale(0.85);
}

.fab-icon {
    font-size: 34px;
    font-weight: 300;
}

@media (max-width: 768px) {
    .bottom-nav {
        display: flex !important; /* Mostrata solo su Mobile */
    }
    
    .fab-add-event.visible {
        display: flex !important;
    }
    
    /* Padding solo su sezione attiva per evitare che sezioni nascoste occupino spazio */
    .view-section.active {
        padding-bottom: 20px !important;
    }
}

/* Nascondi elementi mobile su Desktop */
@media (min-width: 769px) {
    .bottom-nav, .fab-add-event {
        display: none !important;
    }
}

/* HOME CONSOLE & DASHBOARD */
.home-console {
    background: hsla(222, 25%, 5%, 0.5) !important;
    border: 1px solid var(--success) !important;
    border-radius: var(--radius-md) !important;
    padding: 2rem !important;
    box-shadow: 0 10px 40px -10px hsla(160, 84%, 39%, 0.2) !important;
}

.home-live-amount {
    font-size: 3rem !important;
    font-weight: 800 !important;
    color: var(--success) !important;
    text-shadow: 0 0 20px hsla(160, 84%, 39%, 0.4);
    letter-spacing: -1px;
}

.semaphore-physical {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(0,0,0,0.4);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: inset 0 0 15px rgba(0,0,0,0.5);
}

.home-big-btn {
    width: 100%;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: left;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.home-big-btn:hover {
    transform: translateY(-5px);
    background: var(--bg-surface-hover);
}

/* Colori Tematici */
.card-diary:hover { border-color: var(--accent); box-shadow: 0 15px 35px -10px var(--accent-glow); }
.card-diary .btn-icon { color: var(--accent-vibrant); background: hsla(217, 91%, 60%, 0.1); }

.card-ai:hover { border-color: #8b5cf6; box-shadow: 0 15px 35px -10px rgba(139, 92, 246, 0.3); }
.card-ai .btn-icon { color: #a78bfa; background: rgba(139, 92, 246, 0.1); }

.card-pay:hover { border-color: var(--success); box-shadow: 0 15px 35px -10px hsla(160, 84%, 39%, 0.2); }
.card-pay .btn-icon { color: #34d399; background: hsla(160, 84%, 39%, 0.1); }

.home-big-btn .btn-icon {
    font-size: 2.2rem;
    background: hsla(217, 91%, 60%, 0.1);
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.home-big-btn:hover .btn-icon {
    transform: rotate(-10deg) scale(1.1);
}

.btn-title-styled {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.btn-sub-styled {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- ANIMAZIONI CONSOLE --- */
.pulse-red {
    animation: pulse-red-anim 2s infinite;
}

@keyframes pulse-red-anim {
    0% { background: rgba(239, 68, 68, 0.2); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { background: rgba(239, 68, 68, 0.4); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { background: rgba(239, 68, 68, 0.2); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* ==========================================================================
   PRINT STYLES - Fix for Mobile PDF "Screenshot" bug
   ========================================================================== */
@media print {
    /* Hide all UI elements from the main app during print */
    .topbar, 
    .nav-menu, 
    .bottom-nav, 
    .fab, 
    .mobile-drawer, 
    #sidebar-overlay,
    .modal,
    #toast-container,
    .btn:not(.print-visible),
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .view-section {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
    }
}

/* GLOBAL LOADER OVERLAY */
#global-loader {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
}
#global-loader.active {
    display: flex;
}
#global-loader .modern-spinner {
    width: 50px;
    height: 50px;
}

/* BACKUP NUDGE */
.backup-nudge-banner {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 16px;
    padding: 1.2rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    animation: slideInNudge 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px -10px rgba(245, 158, 11, 0.2);
}

@keyframes slideInNudge {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
