/* ==========================================================================
   LIBRARY TYCOON - ARCHITETTURA CSS UNIFICATA
   ==========================================================================
   INDICE DELLE SEZIONI:
   
   00. LOGO
   01. VARIABILI DI SISTEMA & RESET (Colori, Font, Regole Globali)
   02. COMPONENTI DELLA NAVBAR (Navigazione, Stato, Badge Wallet/Punti)
   03. ELEMENTI COMUNI ED UTILITY (Container, Bottoni Standard, Card Base)
   04. SCHERMATE DASHBOARD & HOME (Turni, Riepilogo Ultimo Turno)
   05. GESTIONE SEDI, STRATEGY & MAPPA URBANISTICA (Inventario, Distretti)
   06. GESTIONE PERSONALE / STAFF (Griglie Staff, Competenze, Formazione)
   07. NEGOZIO LIBRI & STRUTTURE (Acquisto blocchi, Magazzino, Offerte)
   08. REPORT BILANCIO DETTAGLIATO (Tabelle, Grafici a Torta, Consulente AI)
   ========================================================================== */




/* ==========================================================================
   01. VARIABILI DI SISTEMA & RESET
   ========================================================================== */
:root {
    --bg-app: #fdfdfd;
    --side-bg: #ffffff;
    --primary-orange: #f39c12;    /* Arancione principale */
    --dark-orange: #d35400;       /* Per hover e testi forti */
    --light-orange: #fff5e6;      /* Sfondi tenui per card */
    --accent-blue: #3498db;       /* Per contrasto tecnico / Tempo */
    --success-green: #27ae60;     /* Per i tasti di conferma e attivi */
    --text-dark: #2c3e50;
    --text-muted: #7f8c8d;
    --border-color: #f1f1f1;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-dark);
    padding-top: 105px; /* Navbar (85px) + Margine di respiro (20px) */
}


/* ==========================================================================
   01.2 CLASSIFICA
   ========================================================================== */
/* Zona Promozione Standard (Verde soft) */
.zone-promotion {
    background-color: rgba(46, 204, 113, 0.12) !important;
    border-left: 4px solid #2ecc71;
}

/* Zona Campione d'Italia (Oro soft per il 1° in Serie A) */
.zone-champion {
    background-color: rgba(241, 196, 15, 0.15) !important;
    border-left: 4px solid #f1c40f;
}

/* Zona Retrocessione (Rosso soft) */
.zone-relegation {
    background-color: rgba(231, 76, 60, 0.12) !important;
    border-left: 4px solid #e74c3c;
}

/* Evidenziatore Utente Corrente */
.zone-current-user {
    font-weight: bold;
}
.zone-current-user .manager-name {
    color: #3498db;
}

/* ==========================================================================
   02. COMPONENTI DELLA NAVBAR (Navigazione e Status Bar)
   ========================================================================== */
.navbar {
    background: white;
    border-bottom: 2px solid var(--primary-orange);
    padding: 0 25px;
    height: 85px;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-top { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
}

.navbar .logo {
    font-weight: 900;
    color: var(--primary-orange);
    font-size: 1.3rem;
    text-transform: uppercase;
}

.nav-links {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    margin: 0 20px;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    margin-left: 20px;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
    transition: 0.2s;
}

.nav-links a:hover {
    background: var(--light-orange);
    color: var(--dark-orange);
}

.menu-toggle { 
    display: none; 
    background: none; 
    border: none; 
    color: var(--primary-orange); 
    font-size: 1.5rem; 
    cursor: pointer; 
}

/* Badge di Stato (Wallet, Punti, Tempo) */
.status-bar { 
    display: flex; 
    gap: 15px; 
    align-items: center; 
}

.stat-item {
    padding: 8px 16px; 
    border-radius: 12px; 
    font-weight: 800;
    font-size: 0.9rem; 
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; 
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item.wallet { 
    background: #ebfbee; 
    color: #27ae60; 
    border: 1px solid #c3e6cb; 
}

.stat-item.points { 
    background: #fff9db; 
    color: #f39c12; 
    border: 1px solid #ffe082; 
}

.stat-item.time { 
    background: #f8f9fa; 
    color: #34495e; 
    border: 1px solid #dcdde1;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.05);
}

.stat-item.time i { 
    color: #3498db; 
}


/* ==========================================================================
   03. ELEMENTI COMUNI ED UTILITY (Container, Card, Pulsanti)
   ========================================================================== */
.container {
    max-width: 1100px; 
    margin: 0 auto;    
    padding: 20px;     
}

.card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.main-header h1 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin: 0;
}

/* Bottoni Generici del Gioco */
.btn-game {
    background: var(--accent-blue);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
}

.btn-new-sede {
    background: var(--success-green);
}

.btn-back-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: #fff;
    color: #555;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid #ddd;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-back-modern i {
    font-size: 0.75rem;
    transition: transform 0.3s ease;
}

.btn-back-modern:hover {
    background: #fdfdfd;
    color: var(--primary-orange);
    border-color: var(--primary-orange);
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.15);
}

.btn-back-modern:hover i {
    transform: translateX(-3px);
}

.text-orange { color: var(--primary-orange); }
.bg-orange { background-color: var(--primary-orange) !important; }	
.bg-green { background-color: #2ecc71 !important; }
.bg-primary { background-color: #3b82f6 !important; }
.bg-danger  { background-color: #ef4444 !important; }
.bg-success { background-color: #10b981 !important; }


/* ==========================================================================
   04. SCHERMATE DASHBOARD & HOME (Turni e Riepiloghi)
   ========================================================================== */
.dashboard-container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Controller avanzamento tempo */
.time-control-card {
    background: var(--light-orange);
    border: 2px solid var(--primary-orange);
    border-radius: 16px;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.time-info h3 { color: var(--dark-orange); margin: 0; }
.time-info p { margin: 5px 0 0 0; color: var(--text-dark); font-size: 0.9rem; }

.btn-advance {
    background: var(--primary-orange);
    color: white;
    padding: 12px 25px;
    border-radius: 8px;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 0 var(--dark-orange); 
    transition: 0.1s;
}

.btn-advance:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 var(--dark-orange);
}

/* Griglia statistiche veloci */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-module {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border-bottom: 4px solid var(--primary-orange);
    text-align: center;
}

/* Riepilogo di fine turno */
.last-week-summary {
    background: #2c3e50; 
    color: white; 
    border-radius: 15px; 
    padding: 20px; 
    margin-bottom: 25px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    display: flex; 
    align-items: center; 
    justify-content: space-between;
}

.summary-info { display: flex; align-items: center; gap: 15px; }
.summary-icon { background: rgba(255,255,255,0.1); width: 45px; height: 45px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.summary-text h4 { margin: 0; font-size: 0.8rem; text-transform: uppercase; opacity: 0.7; letter-spacing: 1px; }
.summary-text p { margin: 0; font-size: 0.9rem; font-weight: 300; }
.summary-stats { display: flex; gap: 30px; }
.stat-group { display: flex; flex-direction: column; }
.text-right { text-align: right; }
.text-success { color: #2ecc71; }
.text-danger { color: #ff7675; }

.total-badge {
    background: rgba(255,255,255,0.05); 
    padding: 5px 15px; 
    border-radius: 8px; 
    border-left: 3px solid var(--colore-netto); 
}
.total-amount { font-size: 1.1rem; color: var(--colore-netto); }


/* ==========================================================================
   05. GESTIONE SEDI, STRATEGY & MAPPA URBANISTICA
   ========================================================================== */
.inventory-list { display: flex; flex-direction: column; gap: 12px; }

.inventory-card {
    background: white;
    border-radius: 12px;
    padding: 15px 20px;
    border: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.inventory-card:hover {
    border-color: var(--primary-orange);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.1);
}

.card-identity { display: flex; align-items: center; gap: 15px; flex: 2; }
.sede-info h4 { margin: 0; font-size: 1.1rem; color: var(--text-dark); }
.sede-info small { color: var(--text-muted); }
.sede-level-badge { background: var(--primary-orange); color: white; font-size: 0.65rem; font-weight: 900; padding: 2px 6px; border-radius: 4px; margin-bottom: 5px; display: inline-block; }

.card-data-flow {
    flex: 1.5;
    display: flex;
    justify-content: space-around;
    gap: 15px;
    border-left: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
    padding: 0 15px;
}

.mini-data-box { text-align: center; }
.mini-data-box .label { display: block; font-size: 0.7rem; text-transform: uppercase; color: var(--text-muted); font-weight: bold; }
.mini-data-box .value { font-size: 1rem; font-weight: 800; color: var(--primary-orange); }

.btn-manage-orange {
    background: var(--light-orange);
    color: var(--dark-orange);
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    transition: 0.2s;
    white-space: nowrap;
}
.btn-manage-orange:hover { background: var(--primary-orange); color: white; }

/* Centro Strategico ed Accordion Sviluppo */
.strategy-center-card { background: #fff; border-radius: 15px; padding: 25px; margin-bottom: 30px; border: 1px solid var(--border-color); box-shadow: var(--shadow); }
.strategy-header { border-bottom: 2px solid var(--light-orange); margin-bottom: 20px; padding-bottom: 15px; }
.strategy-grid-container { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.project-card { background: #fafafa; border: 1px solid #eee; border-radius: 10px; padding: 15px; margin-bottom: 15px; transition: 0.3s; display: flex; flex-direction: column; justify-content: space-between; }
.project-card.project-active { border-left: 5px solid var(--success-green); background: #f0fff4; border-color: #c6f6d5; }

.strategy-accordion { background: #fff; border-radius: 12px; border: 1px solid #e0e0e0; margin-bottom: 25px; overflow: hidden; box-shadow: 0 3px 10px rgba(0,0,0,0.05); transition: all 0.3s ease; }
.strategy-trigger { list-style: none; padding: 15px 25px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; background: linear-gradient(to right, #ffffff, #fff9f2); }
.trigger-content { display: flex; align-items: center; gap: 15px; }
.trigger-icon { width: 45px; height: 45px; background: var(--primary-orange); color: white; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 1.2rem; box-shadow: 0 4px 10px rgba(243, 156, 18, 0.3); }


.stats-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Mantiene la suddivisione interna */
    gap: 15px;
    margin-top: 15px;
}

.stat-box {
    background: #fcfcfc;
    border: 1px solid #f1f1f1;
    padding: 15px;
    border-radius: 12px;
}

.stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: #2c3e50;
}

.stat-sub {
    text-align: right;
}

.stat-sub-label {
    display: block;
    font-size: 0.55rem;
    color: #95a5a6;
    font-weight: 700;
}


/* ==========================================================================
   AGGIORNAMENTO BLINDATO: MAPPA URBANISTICA (DISTRETTI)
   ========================================================================== */
.city-map-container { 
    background-color: #e5e9ed; 
    background-image: radial-gradient(#bdc3c7 1px, transparent 1px); 
    background-size: 30px 30px; 
    padding: 30px; 
    border-radius: 20px; 
    border: 2px solid #d1d8dd; 
    box-shadow: inset 0 0 15px rgba(0,0,0,0.05);
    width: 100%;
    box-sizing: border-box;
}

/* Sostituito auto-fill con auto-fit e ridotto a 280px il minimo per evitare blocchi orizzontali */
.city-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 25px; 
    width: 100%;
    box-sizing: border-box;
}

.district-card { 
    background: #ffffff !important; 
    color: var(--text-dark) !important;
    border-radius: 14px; 
    border: 1px solid #c8d1d9; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.05); 
    transition: transform 0.3s ease, box-shadow 0.3s ease; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.district-card:hover { 
    transform: translateY(-5px); 
    box-shadow: 0 12px 25px rgba(0,0,0,0.12); 
    border-color: var(--primary-orange); 
}

.district-header { 
    background: #f8f9fa; 
    padding: 18px; 
    border-bottom: 1px solid #edf2f7; 
}

.district-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-dark);
}

/* Spaziatura per il corpo centrale delle informazioni del distretto */
.district-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.district-body p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.district-price { 
    background: #fff9f2; 
    border: 1px dashed var(--primary-orange); 
    padding: 12px; 
    border-radius: 8px; 
    text-align: center; 
    margin-top: auto; /* Spinge il prezzo sempre in fondo al body */
}

.price-value { 
    display: block; 
    font-size: 1.3rem; 
    font-weight: 800; 
    color: var(--dark-orange); 
}

/* Contenitore per il pulsante finale di sblocco */
.district-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #edf2f7;
}

.district-footer .btn-game, 
.district-footer button {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

/* --- GESTIONE SEDI: LAYOUT MODERNO --- */
.sede-dashboard-container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* --- 1. CONFIGURAZIONE MOBILE GENERALE --- */
@media (max-width: 768px) {
    /* Forza griglie a colonna singola */
    .stats-overview-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    /* Le card devono adattarsi allo schermo */
    .card-sede, .card-orange-stats {
        padding: 15px !important;
        margin-bottom: 15px;
    }

    /* Coerenza: su mobile meglio 2 o 3 colonne, non 1 lunga */
    .coherence-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* --- 2. OTTIMIZZAZIONE TESTI E RIGHE --- */
.finance-row { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    padding: 8px 0;
    font-size: 0.9rem;
}

.finance-row span {
    word-break: break-word;
    padding-right: 5px;
    line-height: 1.2;
}

/* --- 3. CLASSE BASE UNIFICATA --- */
/* Usiamo una definizione unica per evitare conflitti */
.card-sede, .card-orange-stats {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.03);
    margin-bottom: 20px;
}

/* --- ACCORDION STRATEGIA --- */
.strategy-accordion {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.strategy-trigger {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    list-style: none;
    background: #f8f9fa;
}

.trigger-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.trigger-icon {
    font-size: 1.2rem;
    color: var(--sede-color);
}

.strategy-content-wrapper {
    padding: 20px;
    border-top: 1px solid #eee;
}

/* --- GRIGLIA SVILUPPO (DEV-GRID) --- */
.dev-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.dev-category-title {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1rem;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.dev-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dev-card.active { border-left: 5px solid #27ae60; }
.dev-card.active-purple { border-left: 5px solid #9b59b6; }
.dev-card.cooldown-mode { opacity: 0.8; border-left: 5px solid #95a5a6; }

.dev-bonus-tag {
    font-size: 0.75rem;
    font-weight: bold;
    color: #27ae60;
    background: #e3fcef;
    padding: 2px 8px;
    border-radius: 4px;
}
.dev-bonus-tag.purple { color: #8e44ad; background: #f4ecf7; }

.btn-dev-action {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    background: #3498db;
    color: white;
}

.btn-dev-action.is-active { background: #2ecc71; }
.btn-dev-action.is-active-purple { background: #9b59b6; }

/* ==========================================================================
   06. GESTIONE PERSONALE / STAFF (HR)
   ========================================================================== */
.staff-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 10px; }
.staff-card { background: white; border-radius: 15px; border: 1px solid var(--border-color); padding: 18px; position: relative; transition: 0.3s; box-shadow: var(--shadow); overflow: hidden; }
.staff-card:hover { border-color: var(--primary-orange); transform: translateY(-3px); }
.staff-card.staff-training { background: #fffdf7; border-style: dashed; border-color: #f1c40f; }

.staff-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.staff-avatar-container { position: relative; display: inline-block; }
.staff-avatar-img { width: 60px; height: 60px; border-radius: 50%; background: #f0f2f5; border: 2px solid #ddd; }
.special-badge-mini { position: absolute; bottom: 0; right: 0; background: #f1c40f; color: #000; border-radius: 50%; width: 20px; height: 20px; font-size: 10px; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; }

.staff-skills-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-bottom: 15px; background: #f8f9fa; padding: 8px; border-radius: 8px; }
.skill-tag { font-size: 0.9rem; font-weight: 800; text-align: center; color: #444; }

.staff-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid #f1f1f1; }
.staff-pay strong { color: var(--success-green); font-size: 1.1rem; }

/* Nuovo Menu Formazione a Dropdown */
/* Il contenitore che avvolge il bottone e il menu deve essere relativo */
.dropdown-container {
    position: relative;
    display: inline-block;
}

/* Il menu deve essere posizionato in modo assoluto rispetto al contenitore */
.dropdown-content {
    display: none; /* Nascosto di default */
    position: absolute;
    right: 0; /* Si allinea a destra del contenitore */
    top: 100%; /* Appare subito sotto il bottone */
    background-color: #fff;
    min-width: 160px;
    box-shadow: 0px 8px 16px rgba(0,0,0,0.2);
    z-index: 9999; /* Importante: deve stare sopra tutto */
    border-radius: 8px;
    padding: 5px;
}

.dropdown-content.show {
    display: block; /* Appare quando aggiungi la classe 'show' */
}
.btn-drop { width: 100%; padding: 10px 15px; border: none; background: none; text-align: left; font-size: 0.85rem; cursor: pointer; transition: background 0.2s; display: block; color: #333; border-bottom: 1px solid #f9f9f9; }
.btn-drop:hover { background-color: #f8f9fa; color: #3498db; }

/* Candidati Mercato del Lavoro */
.ex-staff-card { transition: transform 0.3s ease, box-shadow 0.3s ease; background: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.08); position: relative; }
.ex-staff-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }
.score-badge { position: absolute; top: -2px; left: 20px; background: linear-gradient(135deg, #f1c40f, #f39c12); color: white; padding: 5px 15px; border-radius: 20px; font-weight: bold; font-size: 0.8rem; box-shadow: 0 4px 8px rgba(241, 196, 15, 0.3); z-index: 10; }
button[name="assumi"]:hover { background-color: #2ecc71 !important; transform: translateY(-1px); }


/* Card Struttura Globale */
.super-staff-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: grid;
    grid-template-columns: 250px 1fr 220px;
    gap: 20px;
    align-items: center;
}

/* Blocchi Interni */
.staff-header-block { display: flex; align-items: center; gap: 12px; }
.avatar-container { position: relative; cursor: pointer; }
.staff-img { width: 65px; height: 65px; border-radius: 50%; background: #f0f2f5; border: 2px solid #eee; }

/* Badge Specialità e Veterano */
.badge-veterano { position: absolute; bottom: 0; right: 0; background: #2ecc71; color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; border: 2px solid white; }
.badge-special { position: absolute; top: -5px; left: -5px; color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 2; }

/* Competenze */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skill-box { background: #f8f9fa; padding: 5px 8px; border-radius: 6px; border: 1px solid #eee; }
.skill-label { display: flex; justify-content: space-between; font-size: 0.65rem; font-weight: bold; margin-bottom: 2px; }
.skill-bar-bg { width: 100%; height: 4px; background: #ddd; border-radius: 2px; overflow: hidden; }

/* Blocco Azioni Destra */
.staff-actions-block { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid #eee; padding-left: 15px; }
.sede-select { width: 100%; padding: 4px; font-size: 0.8rem; border-radius: 4px; border: 1px solid #ddd; }
.badge-sede-fissa { font-size: 0.75rem; color: #7f8c8d; padding: 4px; font-weight: bold; text-align: center; background: #f8f9fa; border-radius: 4px; border: 1px dashed #ddd; }
.action-buttons-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }

/* Pulsanti Icona Generici */
.btn-action-icon { border: none; cursor: pointer; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 4px; text-decoration: none; }
.btn-study { color: #3498db; background: #ebf5fb; }
.btn-dismiss { color: #e74c3c; background: #fdedec; }

/* Stato Formazione Attiva */
.formazione-status { flex-grow: 1; background: #fff4e5; color: #e67e22; padding: 4px 8px; border-radius: 4px; border: 1px solid #f39c12; font-size: 0.7rem; font-weight: bold; text-align: center; }

/* Sistema Dropdown Corretto */
.dropdown-wrapper { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; right: 0; top: 100%; background: white; z-index: 10; min-width: 150px; box-shadow: 0 4px 10px rgba(0,0,0,0.15); border-radius: 6px; padding: 4px 0; }
.dropdown-content.show { display: block; }

/* Responsive: su schermi piccoli diventa una colonna unica */
@media (max-width: 992px) {
    .super-staff-card { grid-template-columns: 1fr; text-align: center; }
    .staff-actions { border-left: none !important; padding-left: 0 !important; }
}

.staff-header { display: flex; align-items: center; gap: 12px; }
.avatar-container { position: relative; cursor: pointer; }
.staff-img { width: 65px; height: 65px; border-radius: 50%; background: #f0f2f5; border: 2px solid #eee; }

/* Badge */
.badge-veterano { position: absolute; bottom: 0; right: 0; background: #2ecc71; color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; border: 2px solid white; }
.badge-special { position: absolute; top: -5px; left: -5px; color: white; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; border: 2px solid white; box-shadow: 0 2px 4px rgba(0,0,0,0.2); z-index: 2; }

/* Skill Grid */
.skills-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skill-box { background: #f8f9fa; padding: 5px 8px; border-radius: 6px; border: 1px solid #eee; }
.skill-label { display: flex; justify-content: space-between; font-size: 0.65rem; font-weight: bold; margin-bottom: 2px; }
.skill-bar-bg { width: 100%; height: 4px; background: #ddd; border-radius: 2px; overflow: hidden; }

/* Azioni */
.staff-actions { display: flex; flex-direction: column; gap: 8px; border-left: 1px solid #eee; padding-left: 15px; }
.btn-icon { border: none; cursor: pointer; width: 28px; height: 28px; border-radius: 4px; display: flex; align-items: center; justify-content: center; text-decoration: none; }


/* ==========================================================================
   07. NEGOZIO LIBRI & STRUTTURE - AGGIORNAMENTO SVILUPPO.PHP
   ========================================================================== */
.letter-spacing-1 { 
    letter-spacing: 0.5px; 
}

.card-categoria-sviluppo {
    border-radius: 20px; 
    border-left: 6px solid var(--accento-sede) !important; 
    background: #ffffff; 
    box-shadow: 0 5px 20px rgba(0,0,0,0.02) !important;
}

.icona-categoria-box {
    background: var(--accento-sede); 
    color: white; 
    width: 42px; 
    height: 42px; 
    border-radius: 12px; 
    font-size: 1.1rem;
}

.categoria-titolo {
    letter-spacing: -0.3px; 
    font-size: 1.1rem;
}

.btn-pacco-custom {
    width: 100%;
    text-align: left;
    background: #fafbfc;
    border: 1px solid #f0f2f5;
    border-radius: 16px !important;
    padding: 15px 14px !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-pacco-custom:hover {
    background: #ffffff !important;
    border-color: var(--accento-sede) !important;
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.06);
}

.btn-pacco-custom:hover .spec-compra-txt i { 
    transform: translateX(3px); 
}

.btn-pacco-custom:active {
    transform: translateY(-1px);
}

.pacco-info-box {
    display: flex; 
    flex-direction: column; 
    align-items: flex-start;
}

.pacco-label-txt {
    font-size: 0.6rem; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: #95a5a6; 
    letter-spacing: 0.5px;
}

.pacco-qty-txt {
    font-size: 1.15rem; 
    line-height: 1.1; 
    font-weight: 800; 
    color: #2c3e50;
}

.pacco-qty-subtext {
    font-size: 0.75rem; 
    font-weight: 500; 
    color: #7f8c8d;
}

.btn-pacco-custom .badge {
    font-size: 0.6rem; 
    font-weight: 700; 
    padding: 3px 6px; 
    border-radius: 6px; 
    margin-top: 6px;
}

.pacco-prezzo-box {
    text-align: right; 
    display: flex; 
    flex-direction: column; 
    align-items: flex-end; 
    justify-content: center;
}

.pacco-totale-label {
    font-size: 0.65rem; 
    text-transform: uppercase; 
    font-weight: 600; 
    color: #95a5a6;
}

.pacco-price-txt {
    font-size: 1.2rem; 
    font-weight: 850; 
    letter-spacing: -0.5px; 
    color: #2c3e50;
}

.spec-compra-txt {
    font-size: 0.7rem; 
    font-weight: 700; 
    margin-top: 6px; 
    color: var(--accento-sede) !important;
}

.spec-compra-txt i {
    font-size: 0.6rem; 
    transition: transform 0.2s;
}

/* Stili di supporto alla Modale di Rifornimento sviluppo.php */
.style-max-w {
    max-width: 230px;
    display: inline-block;
    vertical-align: middle;
}
.fw-black { 
    font-weight: 850 !important; 
}
#modalConfermaAcquisto .btn:focus,
#modalConfermaAcquisto .btn-close:focus {
    box-shadow: none !important;
}

/* ==========================================================================
   08. REPORT BILANCIO DETTAGLIATO (`bilancio_dettagliato.php`)
   ========================================================================== */
.financial-container { max-width: 1200px; margin: 0 auto; padding: 20px; font-family: 'Segoe UI', system-ui, sans-serif; box-sizing: border-box; }
.header-bilancio { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.header-bilancio h1 { margin: 0; font-size: 2rem; color: #2c3e50; }
.header-bilancio h1 i { color: #2ecc71; margin-right: 10px; }

/* --- Header della Sede --- */
.sede-header-card {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    padding-bottom: 10px;
    border-bottom: 3px solid var(--sede-color);
}

@media (max-width: 600px) {
    .sede-header-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .btn-back-modern {
        width: 100%;
        text-align: center;
    }
}

.sede-title-group h2 {
    color: var(--sede-color);
    margin-bottom: 0;
}

.sede-sector-tag {
    color: #95a5a6;
    font-weight: bold;
    text-transform: uppercase;
    display: block;
}

.btn-back-modern {
    padding: 8px 15px;
    background: #f8f9fa;
    border: 1px solid #eee;
    border-radius: 6px;
    color: #7f8c8d;
    text-decoration: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

.btn-back-modern:hover {
    background: #edf2f7;
    color: #2c3e50;
}

/* Box informativo Lavoro del Turno */
.work-shift-box {
    margin-top: 15px;
    padding: 10px;
    background: #ebf5fb;
    border-radius: 8px;
    border: 1px solid #d6eaf8;
}

.work-shift-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #2980b9;
    font-weight: 700;
    text-transform: uppercase;
}

/* Progresso standard */
.stat-progress-wrapper {
    margin-top: 15px;
}

.stat-progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    margin-bottom: 5px;
}

.progress-container {
    height: 12px;
    background: #eee;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    transition: width 0.5s;
}

/* Pulsante Upgrade */
.btn-upgrade {
    display: block;
    text-align: center;
    background: #2c3e50;
    color: white;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 10px;
}

/* Classe generica per le card della sede */
.card-sede {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    border-left: 5px solid var(--accent-color, #3498db);
}

.card-icon-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.card-icon-title h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--accent-color, #3498db);
}

/* Struttura righe finanziarie */
.finance-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.95rem;
}

/* Stili colore per entrate e uscite */
.text-positive { color: #27ae60; font-weight: bold; }
.text-negative { color: #e74c3c; font-weight: bold; }

/* Totale risultato */
.total-result {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}
.total-result.positive { background: #e3fcef; }
.total-result.negative { background: #ffeded; }

/* Header Sezione Personale */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 30px 0 20px 0;
    clear: both;
}

@media (max-width: 600px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

.section-title {
    color: var(--sede-color);
    margin: 0;
}

.unit-counter {
    font-size: 0.9rem;
    background-color: color-mix(in srgb, var(--sede-color) 10%, transparent);
    color: var(--sede-color);
    padding: 2px 10px;
    border-radius: 10px;
    margin-left: 10px;
}

.btn-small {
    font-size: 0.8rem;
    text-decoration: none;
    color: #7f8c8d;
    transition: 0.2s;
}

.btn-small:hover {
    color: var(--sede-color);
}

/* 4 Card Principali Alti Rendiconti */
.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 40px; }
.stat-card { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 6px rgba(0,0,0,0.05); box-sizing: border-box; }
.stat-card small { display: block; font-size: 0.75rem; font-weight: bold; color: #95a5a6; letter-spacing: 0.5px; }
.stat-card h2 { margin: 8px 0 0 0; font-size: 1.6rem; word-break: break-all; }

.card-entrate { border-bottom: 4px solid #2ecc71; }
.card-entrate h2 { color: #27ae60; }
.card-uscite { border-bottom: 4px solid #e74c3c; }
.card-uscite h2 { color: #c0392b; }
.card-staff { border-bottom: 4px solid #3498db; }
.card-staff h2 { color: #2980b9; }
.card-netto { background: #2c3e50 !important; color: #fff; }
.card-netto.is-positive h2 { color: #2ecc71; }
.card-netto.is-negative h2 { color: #e74c3c; }

/* Tabella delle Singole Sedi */
.dettaglio-sedi { background: #fff; border-radius: 15px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); margin-bottom: 30px; }
.dettaglio-sedi h3 { margin: 0 0 20px 0; border-bottom: 1px solid #eee; padding-bottom: 10px; color: #2c3e50; }
.responsive-table { width: 100%; border-collapse: collapse; text-align: left; }
.responsive-table thead tr { color: #95a5a6; font-size: 0.85rem; text-transform: uppercase; }
.responsive-table th, .responsive-table td { padding: 15px 10px; }
.responsive-table tbody tr { border-bottom: 1px solid #f8f9fa; }

/* Grafici a Torta CSS Dinamici */
.charts-section { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px; }
.chart-box { background: #fff; border-radius: 15px; padding: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); display: flex; align-items: center; gap: 25px; box-sizing: border-box; }
.pie-chart { width: 130px; height: 130px; border-radius: 50%; background: var(--chart-gradient); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pie-center { width: 85px; height: 85px; background: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-direction: column; }

/* Suggerimenti Finanziari Consulente AI */
.consulente-ai { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.ai-card { padding: 20px; border-radius: 12px; box-sizing: border-box; }
.card-warning { background: #fff4e5; border-left: 5px solid #e67e22; }
.card-success { background: #e3fcef; border-left: 5px solid #2ecc71; }
.card-purple { background: #f4efff; border-left: 5px solid #8e44ad; }

/* --- Sotto-Componenti della Tabella di Redditività --- */
.badge-prestigio {
    /* Impostiamo un colore di default arancione se la variabile manca */
    --badge-bg: #f39c12; 
    /* Lo sfondo è una versione chiara (15%) del colore passato */
    background-color: color-mix(in srgb, var(--badge-bg) 15%, white);
    /* Il testo è una versione scura (80%) del colore passato */
    color: color-mix(in srgb, var(--badge-bg) 80%, black);
    border: 1px solid color-mix(in srgb, var(--badge-bg) 30%, white);
    padding: 4px 12px;
    margin: 2px;
    display: inline-block;
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Contenitore grigio della barra di efficienza */
.progress-container {
    width: 100%;
    max-width: 150px;
    background-color: #f1f2f6;
    border-radius: 8px;
    height: 10px;
    overflow: hidden;
    display: inline-block;
    vertical-align: middle;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
}

/* Barra colorata dinamica interna */
.progress-bar {
    height: 100%;
    border-radius: 8px;
    transition: width 0.4s ease;
}

/* Utility colori testo per i margini e record */
.txt-success { 
    color: #27ae60 !important; 
    font-weight: 700; 
}
.txt-danger { 
    color: #c0392b !important; 
    font-weight: 700; 
}

.table-margine {
    font-weight: 800;
}

/* Legenda dei Grafici (Punti colorati) */
.dot {
    display: inline-block;
    margin-right: 6px;
    font-size: 1.1rem;
    line-height: 1;
}
.icon-blue { color: #3498db; }
.icon-yellow { color: #f1c40f; }
.icon-gray { color: #95a5a6; }
.icon-green { color: #2ecc71; }
.icon-teal { color: #1abc9c; }
.icon-purple { color: #8e44ad; }

/* ==========================================================================
   09. COMPONENTE CLASSIFICA GLOBAL & RESPONSIVE CARD
   ========================================================================== */
.leaderboard-container {
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

/* Navigazione tra gironi */
.leaderboard-nav {
    background: #edf2f7;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.leaderboard-nav .nav-title {
    font-size: 0.75rem;
    font-weight: bold;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.nav-buttons-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.btn-camp {
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    transition: all 0.2s ease;
    background: white;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.btn-camp:hover {
    border-color: var(--primary-orange);
    color: var(--primary-orange);
}
.btn-camp.active {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}
.icon-mine {
    font-size: 0.65rem;
    color: #f1c40f;
}

/* Banner Eroe Superiore */
.leaderboard-hero {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}
.hero-content {
    position: relative;
    z-index: 2;
}
.hero-content h1 {
    margin: 0;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}
.hero-content p {
    margin: 10px 0 0 0;
    opacity: 0.85;
    font-size: 0.95rem;
}
.icon-gold { color: #f1c40f; }
.hero-bg-icon {
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 9rem;
    opacity: 0.08;
    transform: rotate(-15deg);
    pointer-events: none;
}

/* Struttura Tabella Desktop */
.leaderboard-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #e2e8f0;
}
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}
.leaderboard-table thead tr {
    background: #f8f9fa;
    border-bottom: 2px solid #edf2f7;
    text-align: left;
}
.leaderboard-table th {
    padding: 18px 20px;
    color: #718096;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}
.leaderboard-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s ease;
}
.leaderboard-table tbody tr:hover {
    background-color: #fafafa !important;
}
.leaderboard-table td {
    padding: 16px 20px;
    vertical-align: middle;
}

/* Allineamenti e Helper */
.txt-center { text-align: center !important; }
.font-bold { font-weight: 800; }
.font-semibold { font-weight: 600; }

/* Stati righe (Colori gironi) */
.zone-promotion { background-color: #f0fff4; border-left: 4px solid #2ecc71; }
.zone-relegation { background-color: #fff5f5; border-left: 4px solid #e74c3c; }
.zone-current-user { 
    background-color: #ebf8ff !important; 
    border-left: 4px solid #3182ce !important; 
    outline: 1px solid #3182ce;
}

/* Elementi interni alla riga */
.cell-position {
    font-size: 1.1rem;
    font-weight: 800;
    color: #2d3748;
}
.player-profile-box {
    display: flex;
    align-items: center;
    gap: 15px;
}
.player-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    object-fit: cover;
}
.player-info-text {
    display: flex;
    flex-direction: column;
}
.network-name {
    font-weight: 800;
    color: #2d3748;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.manager-name {
    font-size: 0.75rem;
    color: #718096;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.badge-you {
    font-size: 0.65rem;
    background: #3182ce;
    color: white;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 800;
}
.cell-ipb { color: #6b46c1; font-size: 1.05rem; }
.cell-round { color: #38a169; }


/* ==========================================================================
   MEDIA QUERY PER MOBILE (TRASFORMAZIONE IN CARD)
   ========================================================================== */
@media (max-width: 768px) {
    
    .leaderboard-container {
        padding: 10px;
    }
    
    .leaderboard-card {
        background: transparent;
        box-shadow: none;
        border: none;
    }
    
    /* Nascondiamo l'intestazione standard della tabella desktop */
    .leaderboard-table thead {
        display: none;
    }
    
    /* Convertiamo gli elementi strutturali in blocchi fluidi verticali */
    .leaderboard-table, 
    .leaderboard-table tbody, 
    .leaderboard-table tr, 
    .leaderboard-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Ogni riga della classifica si trasforma in una card staccata */
    .leaderboard-table tbody tr {
        margin-bottom: 16px;
        border: 1px solid #cbd5e0;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: 0 3px 6px rgba(0,0,0,0.02);
        padding: 10px 0;
        position: relative; /* Indispensabile per ancorare il badge posizione */
    }
    
    /* Resettiamo i bordi laterali desktop per non fare doppioni brutti */
    .zone-promotion, .zone-relegation, .zone-current-user {
        border-left: none !important;
    }
    
    /* Indicatori grafici di promozione/retrocessione visibili sui bordi esterni delle card mobile */
    .leaderboard-table tbody tr.zone-promotion { border-left: 5px solid #2ecc71 !important; }
    .leaderboard-table tbody tr.zone-relegation { border-left: 5px solid #e74c3c !important; }
    .leaderboard-table tbody tr.zone-current-user { 
        border: 2px solid #3182ce !important;
        background: #f7fbe8;
    }

    /* Struttura celle interne */
    .leaderboard-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 16px;
        font-size: 0.9rem;
        border: none;
        text-align: right;
    }
    
    /* Generiamo le etichette di testo leggendo l'attributo data-label */
    .leaderboard-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #718096;
        text-transform: uppercase;
        font-size: 0.7rem;
        text-align: left;
    }
    
    /* RIPOSIZIONAMENTO STRATEGICO DELLA POSIZIONE (Es: 1°, 2°...) */
    .leaderboard-table td.cell-position {
        position: absolute;
        top: 12px;
        right: 12px;
        width: auto;
        padding: 0;
        z-index: 10;
    }
    .leaderboard-table td.cell-position::before { display: none; } /* Rimuoviamo la scritta "Posizione:" */
    
    .rank-badge {
        background: #2d3748;
        color: white;
        padding: 4px 10px;
        border-radius: 8px;
        font-size: 0.9rem;
        font-weight: 900;
    }
    /* Colori speciali del badge di posizione sul podio mobile */
    .zone-promotion .rank-badge { background: #2ecc71; }
    .zone-current-user .rank-badge { background: #3182ce; }

    /* L'intestazione della biblioteca prende tutta la larghezza in alto alla card */
    .leaderboard-table td[data-label="Biblioteca"] {
        background: #f8f9fa;
        padding: 12px 16px;
        margin-top: -10px;
        margin-bottom: 10px;
        border-bottom: 1px solid #edf2f7;
        justify-content: flex-start;
    }
    .leaderboard-table td[data-label="Biblioteca"]::before { display: none; } /* Rimuoviamo "Biblioteca:" */
    
    .zone-current-user td[data-label="Biblioteca"] {
        background: #ebf8ff;
    }
    
    /* Correzioni allineamento dati mobile */
    .cell-ipb, .cell-round {
        text-align: right !important;
    }
}

/* ==========================================================================
   05. GESTIONE SEDI & MAPPA URBANISTICA - RESTRUTTURAZIONE INPUT
   ========================================================================== */
.form-apertura-mappa {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Input di testo moderno e arrotondato */
.input-group-modern-mappa {
    position: relative;
    width: 100%;
    margin-bottom: 12px;
}

.input-group-modern-mappa .input-icon-left {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #a0aec0;
    font-size: 0.85rem;
    pointer-events: none;
}

.input-group-modern-mappa input[type="text"] {
    width: 100%;
    padding: 11px 15px 11px 38px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px !important;
    font-size: 0.85rem;
    font-weight: 500;
    color: #2d3748;
    transition: all 0.2s ease;
}

.input-group-modern-mappa input[type="text"]:focus {
    background: #ffffff;
    border-color: var(--primary-orange) !important;
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15);
}

/* Box di selezione colore pulito e minimale */
.color-picker-wrapper-mappa {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 8px 14px;
    margin-bottom: 16px;
    transition: border-color 0.2s ease;
}

.color-picker-wrapper-mappa:hover {
    border-color: #cbd5e1;
}

.color-picker-wrapper-mappa .color-label-txt {
    font-size: 0.72rem;
    color: #718096;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Nasconde il brutto bordo nativo del selettore di colore del browser */
.color-input-container {
    width: 32px;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.color-input-container input[type="color"] {
    border: none;
    width: 140%;
    height: 140%;
    margin: -20%;
    cursor: pointer;
    background: none;
}

/* Pulsante "APRI QUI" coordinato con lo stile del gioco */
.btn-open-district-mappa {
    width: 100%;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 14px !important;
    padding: 12px 20px !important;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-open-district-mappa:hover {
    background: var(--dark-orange);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(211, 84, 0, 0.3);
}

.btn-open-district-mappa:active {
    transform: translateY(0);
}

/* ==========================================================================
   09. SCHERMATA PROFILO UTENTE
   ========================================================================== */
.profile-container {
    max-width: 800px;
    margin: 20px auto;
    padding: 0 15px;
}

.profile-header { 
    background: linear-gradient(135deg, #2c5282 0%, #2b6cb0 100%); 
    border-radius: 20px;
    padding: 40px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.avatar-frame {
    width: 130px;
    height: 130px;
    border-radius: 50%; 
    border: 4px solid white;
    background: white;
    margin: 0 auto 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    cursor: pointer;
}

.avatar-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.avatar-frame:hover .avatar-overlay {
    opacity: 1;
}

/* Box info ID Utente */
.profile-id-box {
    margin: 5px auto 12px auto;
    background: rgba(0, 0, 0, 0.2);
    display: inline-block;
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 0.65rem;
    border: 1px solid rgba(255,255,255,0.15);
}

.profile-id-box strong {
    font-family: monospace;
    letter-spacing: 0.5px;
    color: #f1c40f;
}

/* Badge "In servizio dal..." CORRETTO per contrasto */
.profile-date-badge {
    background: rgba(0, 0, 0, 0.25) !important;
    color: #ffffff !important;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 500;
}

.stat-box { 
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 15px; 
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.stats-row {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.trophy-section {
    background: white;
    padding: 25px;
    border-radius: 20px;
    margin-top: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.trophy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.trophy {
    text-align: center;
    color: #cbd5e0;
    transition: 0.3s;
    cursor: help;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
}

.trophy.active {
    color: #ecc94b;
    transform: scale(1.1);
}

.trophy.active:hover {
    background: #f7fafc;
    transform: translateY(-5px) scale(1.1);
}

.trophy i {
    font-size: 2.5rem;
}

.trophy p {
    font-size: 0.7rem;
    margin-top: 5px;
    color: #4a5568;
    font-weight: bold;
    text-transform: uppercase;
    line-height: 1.1;
}

.trophy small {
    opacity: 0.8;
    background: rgba(0,0,0,0.05);
    padding: 2px 5px;
    border-radius: 4px;
    margin-top: 4px;
    font-size: 0.6rem;
    color: #718096;
    display: block;
}

.trophy.locked p,
.trophy.locked small {
    color: #a0aec0;
    background: transparent;
}

.gen-box {
    display: none;
    background: rgba(255,255,255,0.1); 
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    border: 1px dashed rgba(255,255,255,0.3);
}

.gen-box input[type="text"] {
    padding: 8px;
    border-radius: 5px;
    border: none;
    width: 200px;
    outline: none;
    color: #333;
}

.btn-gen {
    padding: 8px 15px;
    background: #48bb78;
    color: white;
    border: none; 
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
    
.badge-level-tag {
    position: absolute; 
    bottom: -2px; 
    right: -2px; 
    background: #f1c40f;
    color: #2c3e50; 
    border-radius: 50%; 
    width: 20px; 
    height: 20px; 
    font-size: 11px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 900; 
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Box Sponsor Amazon Scelte */
.amazon-profile-box {
    border: 1px solid #ff9900;
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.amazon-profile-box img {
    max-width: 70px;
    max-height: 90px;
    width: auto;
    height: auto;
    border-radius: 6px;
}

.amazon-profile-box .btn-amazon {
    background: #ff9900;
    color: white;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    font-family: sans-serif;
    transition: background 0.2s;
}

/* Responsive Mobile inherits from existing logic */
@media (max-width: 768px) {
    .stats-row { 
        flex-direction: column; 
    }
}

/* ==========================================================================
   10. PAGINA DI ATTERRAGGIO (INDEX OSPITI)
   ========================================================================== */
.index-body {
    padding-top: 0 !important;
}

.index-top-nav {
    background: rgba(44, 62, 80, 0.95);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0; /* Assicura che sia attaccata al soffitto della pagina */
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.index-top-nav .brand {
    color: #ffffff;
    font-weight: 800;
    font-size: 1.1rem;
    text-decoration: none;
}

.index-top-nav .nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.index-top-nav .nav-links a {
    color: #e2e8f0;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.index-top-nav .nav-links a:hover {
    color: #ffffff;
}

.index-top-nav .btn-access {
    background: var(--primary-orange);
    padding: 6px 14px;
    border-radius: 6px;
    color: white !important;
    transition: background 0.2s !important;
}

.index-top-nav .btn-access:hover {
    background: var(--dark-orange);
}

/* Hero principale con pendenza bilanciata */
.index-hero {
    background: linear-gradient(135deg, #2b6cb0 0%, #2c5282 100%);
    color: #ffffff;
    padding: 60px 20px 140px; 
    text-align: center;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 100% 92%, 0% 100%);
    margin-top: 0; /* Forza l'azzeramento di marigni esterni */
}

.index-hero h1 { 
    font-size: 3.5rem; 
    margin: 0; /* Cambiato da margin-top a 0 per non spingere in alto */
    padding-top: 10px; /* Usa il padding se vuoi distanziarlo dall'alto */
    letter-spacing: -2px; 
    font-weight: 800;
}

.index-hero p { 
    font-size: 1.25rem; 
    opacity: 0.9; 
    margin: 15px 0 25px; 
}

.index-world-clock {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 600;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* Griglia Statistiche ad effetto vetro solido */
.index-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: -80px; 
    position: relative;
    z-index: 10;
}

.index-stat-card {
    background: rgba(255, 255, 255, 0.85); 
    padding: 25px 20px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); 
    box-shadow: 0 8px 25px rgba(31, 38, 135, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.index-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(31, 38, 135, 0.15);
}

.index-stat-card i { font-size: 2rem; color: #2c5282; margin-bottom: 10px; display: block; }
.index-stat-card h3 { color: #2c5282; margin: 5px 0; font-size: 1.8rem; font-weight: 700; }
.index-stat-card p { color: #2d3748; margin: 0; font-size: 0.95rem; }

/* Caratteristiche */
.index-features-section {
    margin: 60px 0;
    text-align: center;
}

.index-features-section h2 { font-size: 2.2rem; margin-bottom: 40px; color: #2c5282; font-weight: 700; }

.index-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 25px;
}

.index-feature-box {
    background: #ffffff;
    padding: 30px 25px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    text-align: left;
}

.index-feature-box:hover { 
    border-color: #2b6cb0; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.04); 
}

.index-feature-box i { font-size: 1.8rem; color: var(--primary-orange); margin-bottom: 15px; display: block; }
.index-feature-box h4 { margin: 0 0 10px 0; font-size: 1.2rem; color: #2d3748; }
.index-feature-box p { margin: 0; color: #718096; font-size: 0.95rem; line-height: 1.5; }

/* Area CTA unificata */
.index-cta-area {
    background: #2c5282;
    color: white;
    padding: 50px 30px;
    border-radius: 25px;
    text-align: center;
    margin: 40px 0 60px;
}

.index-cta-area h2 { font-weight: 700; margin-bottom: 10px; }
.index-cta-area .btn-group { margin-top: 25px; display: flex; justify-content: center; gap: 15px; flex-wrap: wrap; }

.index-btn {
    display: inline-block;
    padding: 14px 35px;
    border-radius: 50px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.index-btn-light { background: #ffffff; color: #2c5282; }
.index-btn-light:hover { background: #edf2f7; transform: translateY(-2px); }

.index-btn-outline { border: 2px solid #ffffff; color: #ffffff; }
.index-btn-outline:hover { background: rgba(255,255,255,0.1); transform: translateY(-2px); }

/* Vetrina Sponsor Amazon Unificata e Responsiva */
.index-amazon-section {
    background: #f7fafc; 
    padding: 40px 20px; 
    text-align: center; 
    border-top: 1px solid #e2e8f0;
}

.index-amazon-title { font-weight: 700; color: #2d3748; margin-bottom: 5px; }
.index-amazon-text { max-width: 600px; margin: 0 auto 30px auto; font-size: 0.9rem; color: #4a5568; line-height: 1.4; }
.index-amazon-grid { display: flex; justify-content: center; gap: 20px; flex-wrap: wrap; }

.index-amazon-card {
    background: white; 
    border: 1px solid #e2e8f0; 
    border-radius: 10px; 
    padding: 20px; 
    width: 260px; 
    box-sizing: border-box;
    text-align: left; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}

.index-amazon-card:hover { transform: translateY(-3px); }
.index-amazon-img-container { text-align: center; margin-bottom: 15px; height: 120px; display: flex; align-items: center; justify-content: center; }
.index-amazon-img-container img { max-height: 120px; max-width: 100%; width: auto; object-fit: contain; }
.index-amazon-card h4 { font-size: 0.85rem; margin: 0 0 8px 0; height: 38px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: #2d3748; line-height: 1.3; }
.index-amazon-price { color: #2b6cb0; font-weight: bold; margin: 0 0 15px 0; font-size: 1.1rem; }

.index-amazon-btn {
    background: #232f3e; 
    color: white; 
    text-align: center; 
    padding: 10px; 
    border-radius: 6px; 
    text-decoration: none; 
    font-size: 0.8rem; 
    font-weight: bold; 
    display: block;
    transition: background 0.2s;
}
.index-amazon-btn:hover { background: #37475a; }

/* Footer istituzionale scuro */
.index-footer {
    background: #1a202c;
    color: #ffffff;
    padding: 40px 20px;
    text-align: center;
    margin-top: auto;
}

.index-footer-links {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.index-footer-links a {
    color: #a0aec0;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.index-footer-links a:hover { color: #ffffff; }

/* RESPONSIVE BREAKPOINTS (MOBILE & TABLET) */
@media (max-width: 768px) {
    .index-hero h1 { font-size: 2.3rem; }
    .index-hero p { font-size: 1.05rem; }
    .index-hero { padding: 40px 15px 100px; clip-path: polygon(0 0, 100% 0, 100% 95%, 0% 100%); }
    .index-top-nav { padding: 10px 15px; }
    .index-top-nav .nav-links { gap: 12px; }
    .index-top-nav .nav-links a span { display: none; } /* Nasconde i testi dei link icone su schermi minuscoli se necessario */
    .index-stats-grid { margin-top: -50px; padding: 0 10px; }
    .index-features-section h2 { font-size: 1.7rem; }
    .index-amazon-card { width: 100%; max-width: 320px; }
}

/* ==========================================================================
   09. SCHERMATE DI AUTENTICAZIONE UNIFICATE (BIBLIOLINK)
   ========================================================================== */
.auth-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f4f6f9;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;
    color: #2c3e50;
}

/* Card Contenitore */
.login-card, .reg-card {
    background: white;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.06);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

/* Struttura del Brand Logo */
.brand-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 5px;
}

.brand-logo-container.margin-login {
    margin-bottom: 25px;
}

.logo-icon {
    position: relative;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #3182ce, #1a365d);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.logo-icon .fa-book-open {
    color: white;
    font-size: 1.2rem;
    position: absolute;
    transform: translate(-3px, -3px);
}

.logo-icon .fa-link {
    color: #3182ce;
    font-size: 0.8rem;
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: #fff;
    padding: 2.5px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.logo-text {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.logo-text .brand-main {
    font-weight: 800;
    font-size: 1.6rem;
    color: #1a252f;
    letter-spacing: -0.5px;
    line-height: 1;
}

.logo-text .brand-main span {
    color: #3182ce;
}

.logo-text .brand-sub {
    font-size: 0.7rem;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.auth-subtitle-text {
    color: #7f8c8d;
    font-size: 0.88rem;
    margin: 0 0 25px 0;
    text-align: center;
    font-weight: 500;
}

/* Form e Input */
.login-card label, .reg-card label {
    font-weight: 600;
    color: #34495e;
    display: block;
    margin-top: 16px;
    font-size: 0.88rem;
    text-align: left;
}

.login-card label i, .reg-card label i {
    color: #3182ce;
    margin-right: 4px;
    width: 16px;
    text-align: center;
}

.login-card input[type="text"],
.login-card input[type="password"],
.reg-card input[type="text"],
.reg-card input[type="email"],
.reg-card input[type="password"],
.reg-card input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    margin-top: 6px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    color: #2c3e50;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card input:focus, .reg-card input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

/* Bottoni */
.auth-btn, .reg-card button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: #3182ce;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 25px;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.auth-btn:hover, .reg-card button[type="submit"]:hover {
    background: #1a365d;
}

.auth-btn:active, .reg-card button[type="submit"]:active {
    transform: scale(0.98);
}

/* Box Messaggi Errore e Successo */
.error-box, .msg.error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

.msg.success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #9ae6b4;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}

/* Link e Elementi Accessori */
.auth-meta-links {
    text-align: right;
    margin-top: 10px;
}

.auth-meta-links a {
    color: #3182ce;
    text-decoration: none;
    font-size: 0.85rem;
}

.auth-meta-links a:hover {
    text-decoration: underline;
}

.auth-footer-notice, .auth-footer-redirect {
    text-align: center;
    margin-top: 25px;
    font-size: 0.88rem;
    color: #7f8c8d;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    line-height: 1.5;
}

.auth-footer-notice a, .auth-footer-redirect a {
    color: #3182ce;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    margin-top: 4px;
}

.auth-footer-notice a:hover, .auth-footer-redirect a:hover {
    text-decoration: underline;
}

/* Sicurezza e Privacy Checkbox */
.antispam-box {
    background: #f8fafc;
    padding: 14px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px dashed #cbd5e0;
    text-align: center;
}

.antispam-box label {
    margin: 0 !important;
    font-size: 0.85rem !important;
    color: #4a5568 !important;
    text-align: center !important;
    display: inline-block !important;
}

.antispam-box input {
    width: 90px !important;
    text-align: center;
    margin-top: 8px;
    padding: 6px !important;
}

.privacy-box {
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.privacy-box input[type="checkbox"] {
    width: auto !important;
    margin-top: 3px;
    cursor: pointer;
}

.privacy-box label {
    margin: 0 !important;
    font-weight: normal !important;
    font-size: 0.85rem !important;
    line-height: 1.4;
    color: #4a5568;
    cursor: pointer;
}

.privacy-box a {
    color: #3182ce;
    text-decoration: none;
    font-weight: 700;
}

.hidden-field {
    display: none !important;
    visibility: hidden;
}

/* ==========================================================================
   09. SCHERMATE DI AUTENTICAZIONE UNIFICATE
   ========================================================================== */
.auth-body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-app);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;
    color: var(--text-dark, #2c3e50);
}

.auth-card {
    background: #ffffff;
    padding: 35px;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 460px;
    box-sizing: border-box;
    border-top: 5px solid var(--primary-orange);
}

/* Messaggi di notifica */
.auth-msg {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left;
}
.auth-msg.error {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}
.auth-msg.success {
    background: #f0fff4;
    color: #2f855a;
    border: 1px solid #9ae6b4;
}

/* Form e controlli di input */
.auth-form label {
    font-weight: 600;
    color: #34495e;
    display: block;
    margin-top: 16px;
    font-size: 0.88rem;
    text-align: left;
}
.auth-form label i {
    color: var(--primary-orange);
    margin-right: 5px;
    width: 16px;
    text-align: center;
}
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="number"] {
    width: 100%;
    padding: 11px 14px;
    margin-top: 6px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.95rem;
    color: #2c3e50;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-form input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15);
}

/* Sezione Anti-Spam matematico */
.auth-antispam-box {
    background: #f8fafc;
    padding: 14px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px dashed #cbd5e0;
    text-align: center;
}
.auth-antispam-box label {
    margin: 0 !important;
    font-size: 0.85rem !important;
    color: #4a5568 !important;
    text-align: center !important;
    display: inline-block !important;
}
.auth-antispam-box input {
    width: 90px !important;
    text-align: center;
    margin-top: 8px;
    padding: 6px !important;
}

/* Box Privacy Checkbox */
.auth-privacy-box {
    margin-top: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.auth-privacy-box input[type="checkbox"] {
    width: auto !important;
    margin-top: 3px;
    cursor: pointer;
}
.auth-privacy-box label {
    margin: 0 !important;
    font-weight: normal !important;
    font-size: 0.85rem !important;
    line-height: 1.4;
    color: #4a5568;
    cursor: pointer;
    text-align: left !important;
}
.auth-privacy-box a {
    color: var(--primary-orange);
    text-decoration: none;
    font-weight: 700;
}
.auth-privacy-box a:hover {
    text-decoration: underline;
}

/* Bottone submit */
.auth-form button[type="submit"] {
    width: 100%;
    padding: 14px;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 25px;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.auth-form button[type="submit"]:hover {
    background: var(--dark-orange);
}
.auth-form button[type="submit"]:active {
    transform: scale(0.98);
}

/* Footer link di rinvio */
.auth-footer-redirect {
    text-align: center;
    margin-top: 25px;
    font-size: 0.88rem;
    color: #7f8c8d;
    border-top: 1px solid #e2e8f0;
    padding-top: 20px;
    line-height: 1.5;
}
.auth-footer-redirect a {
    color: var(--primary-orange);
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    margin-top: 4px;
}
.auth-footer-redirect a:hover {
    text-decoration: underline;
}

.hidden-field {
    display: none !important;
    visibility: hidden;
}

/* ==========================================================================
   12. MANUALE DEL GIOCO (WIKI INTERNA ED ESTERNA)
   ========================================================================== */
.wiki-ospite {
    padding-top: 0 !important; /* Rimuove il padding di 105px se è un ospite */
    background-color: #f7fafc;
}

/* Navigazione superiore per visitatori */
.wiki-top-nav {
    background: #2c5282; 
    padding: 15px 20px; 
    color: #ffffff; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.wiki-top-nav .brand-title {
    font-size: 1.2rem; 
    font-weight: bold;
}

.wiki-top-nav .nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.wiki-top-nav .nav-links a {
    color: #ffffff; 
    text-decoration: none; 
    font-weight: bold; 
    font-size: 0.9rem;
    transition: opacity 0.2s;
}

.wiki-top-nav .nav-links a:hover {
    opacity: 0.8;
}

.wiki-top-nav .btn-login {
    background: #48bb78; 
    padding: 6px 14px; 
    border-radius: 4px;
    transition: background 0.2s !important;
}

.wiki-top-nav .btn-login:hover {
    background: #38a169;
}

/* Contenitore Layout Wiki con Sidebar */
.wiki-container {
    max-width: 1000px; 
    margin: 30px auto; 
    padding: 0 20px; 
    display: flex; 
    gap: 30px; 
}

/* Sidebar di navigazione capitoli */
.wiki-sidebar {
    width: 250px; 
    background: #f7fafc; 
    padding: 20px; 
    border-radius: 8px; 
    height: fit-content; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05); 
    border: 1px solid #e2e8f0;
    box-sizing: border-box;
}

.wiki-sidebar h3 {
    margin-top: 0; 
    color: #2d3748;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.wiki-sidebar ul {
    list-style: none; 
    padding: 0; 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    gap: 10px;
}

.wiki-sidebar ul li a {
    text-decoration: none; 
    font-size: 0.95rem;
    display: block;
    transition: color 0.2s;
}

.wiki-sidebar ul li a.active {
    color: #3182ce; 
    font-weight: bold;
}

.wiki-sidebar ul li a.inactive {
    color: #4a5568;
}

.wiki-sidebar ul li a:hover {
    color: #3182ce;
}

/* Corpo centrale del testo */
.wiki-main-content {
    flex: 1; 
    background: #ffffff; 
    padding: 30px; 
    border-radius: 8px; 
    border: 1px solid #e2e8f0; 
    line-height: 1.6; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    color: #2d3748;
}

.wiki-main-content h2 {
    color: #2c5282;
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.wiki-main-content p {
    margin-bottom: 15px;
}

.wiki-main-content ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.wiki-main-content ul li {
    margin-bottom: 5px;
}

/* Callout evidenziato (es. Turni) */
.wiki-blockquote {
    margin: 20px 0; 
    padding: 15px; 
    background: #ebf8ff; 
    border-left: 4px solid #3182ce; 
    color: #2b6cb0;
    border-radius: 0 8px 8px 0;
    font-size: 0.95rem;
}

/* RESPONSIVE PER SMARTPHONE E TABLET */
@media (max-width: 768px) {
    .wiki-container {
        flex-direction: column; /* La sidebar va in cima, il testo sotto */
        margin: 15px auto;
        gap: 20px;
    }
    
    .wiki-sidebar {
        width: 100%; /* Larghezza piena su mobile */
    }
    
    .wiki-sidebar ul {
        flex-direction: row; /* Menu orizzontale scorrevole o flessibile su mobile */
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .wiki-main-content {
        padding: 20px;
    }
    
    .wiki-main-content h2 {
        font-size: 1.5rem;
    }
}

/* ==========================================================================
   10. SUPER MEDIA QUERY RESPONSIVE COMPLETA (Ottimizzazione Mobile)
   ========================================================================== */
@media (max-width: 992px) {
    .nav-container { flex-direction: column; align-items: stretch; }
    .navbar { height: auto; padding: 10px 20px; }
    .menu-toggle { display: block; }
    .nav-links { justify-content: center; margin: 0 20px; }
    .nav-links.active { display: flex; } 
    .nav-links a { margin: 0 10px; padding: 10px 15px; }
    .status-bar { justify-content: center; padding: 10px 0; border-top: 1px solid var(--border-color); width: 100%; }
    .strategy-grid-container { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    body { padding-top: 15px !important; }
    .navbar { position: relative !important; height: auto !important; padding: 15px !important; flex-direction: column !important; gap: 15px; }
    .nav-container { flex-direction: column !important; align-items: stretch !important; gap: 12px; }
    .nav-links { margin: 5px 0 !important; flex-wrap: wrap; justify-content: center !important; gap: 8px; }
    .nav-links a { margin: 0 !important; padding: 8px 10px !important; font-size: 0.8rem !important; }
    
    .status-bar { width: 100% !important; justify-content: space-between !important; gap: 8px !important; padding-top: 12px !important; }
    .stat-item { flex: 1 !important; justify-content: center; padding: 8px !important; font-size: 0.8rem !important; white-space: normal !important; text-align: center; }

    .time-control-card { flex-direction: column !important; text-align: center; padding: 15px !important; gap: 15px; }
    .btn-advance { width: 100% !important; justify-content: center; }

    /* Forzatura Griglie ad Albero Singolo */
    .inventory-card { flex-direction: column !important; align-items: stretch !important; gap: 15px !important; padding: 15px !important; }
    .card-data-flow { border-left: none !important; border-right: none !important; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; padding: 10px 0 !important; width: 100% !important; justify-content: space-around !important; }
    .btn-manage-orange, .card-actions, .btn-upgrade { width: 100% !important; display: block !important; text-align: center !important; }

    .staff-grid { grid-template-columns: 1fr !important; }
    .staff-skills-strip { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
    .staff-card-footer { flex-direction: column !important; gap: 12px; align-items: stretch !important; }

    .city-map-container { padding: 15px !important; border-radius: 10px !important; }
    .city-grid, .strategy-grid-container, .dev-grid, .consulente-ai { grid-template-columns: 1fr !important; }

    /* Trasformazione Tabelle di Bilancio in Card Unità */
    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table tr { margin-bottom: 15px; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 0; background: #fdfdfd; }
    .responsive-table td { text-align: right; padding: 8px 15px; font-size: 0.9rem; position: relative; display: flex; justify-content: space-between; align-items: center; border: none; }
    .responsive-table td::before { content: attr(data-label); font-weight: bold; color: #718096; text-transform: uppercase; font-size: 0.75rem; text-align: left; }
    .table-sede-title { background: #edf2f7; margin-top: -8px; padding: 10px 15px !important; border-bottom: 1px solid #e2e8f0 !important; font-size: 1rem !important; }

    .grid-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; margin-bottom: 25px; }
    .charts-section { grid-template-columns: 1fr !important; gap: 20px; }
    .chart-box { flex-direction: column; text-align: center; }


    /* Sezione Riepilogo Ultimo Turno Mobile */
    .last-week-summary { flex-direction: column !important; gap: 20px; text-align: center; padding: 20px 15px; width: 100%; }
    .summary-info { flex-direction: column !important; gap: 10px; }
    .summary-stats { flex-direction: column !important; width: 100%; gap: 15px; }
    .text-right { text-align: center !important; }
    .stat-group { align-items: center; width: 100%; }
    .stat-group strong { font-size: 1.2rem !important; display: block; margin-top: 2px; word-break: break-all; }
    .total-badge { border-left: none !important; border-top: 3px solid var(--colore-netto) !important; padding: 12px 15px !important; background: rgba(255, 255, 255, 0.02); width: 100%; }
}

@media (max-width: 576px) {
    .btn-block-purchase { min-height: 110px; padding: 10px 5px !important; }
    .qty-display { font-size: 1.1rem; }
    .price-display { font-size: 0.75rem; }
    .buy-block-btn-horizontal { min-height: 100px; padding: 10px 2px !important; }
}

/* Animazioni */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.01); }
    100% { transform: scale(1); }
}