
        /* Token di design: stessi valori gia' usati in tutta l'app (nessuna
           modifica visiva), centralizzati qui per le nuove regole sotto e per
           i futuri interventi di stile. */
        :root {
            --color-primary: #003366;
            --color-accent: #3498db;
            --color-accent-dark: #2980b9;
            --color-danger: #e74c3c;
            --color-warning: #f1c40f;
            --color-orange: #e67e22;
            --color-success: #2ecc71;
            --color-success-dark: #27ae60;
            --color-purple: #9b59b6;
            --color-purple-dark: #8e44ad;
            --radius-card: 16px;
            --radius-btn: 12px;
        }

        body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #f4f6f8; margin: 0; padding-bottom: 90px; color: #333; -webkit-tap-highlight-color: transparent; }
        
        /* Header */
        .app-header { background: rgba(0, 51, 102, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); color: white; padding: 25px 20px 60px 20px; border-radius: 0 0 30px 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); text-align: center; position: relative; z-index: 10; }
        .logo-container { background: rgba(255, 255, 255, 0.9); width: 80px; height: 80px; border-radius: 50%; margin: 0 auto 10px auto; display: flex; align-items: center; justify-content: center; border: 4px solid rgba(255,255,255,0.3); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
        .logo-container img { max-width: 60px; max-height: 60px; }
        .app-title { margin: 0; font-size: 1.5rem; font-weight: 800; text-transform: uppercase; }
        .app-subtitle { font-size: 0.8rem; margin-top: 8px; font-weight: 700; background: rgba(255,255,255,0.2); display: inline-block; padding: 6px 16px; border-radius: 20px; color: white; }

        /* Pulsante Info e Impostazioni */
        /* 44x44 invece di 38x38: dimensione minima raccomandata per un target
           di tocco (WCAG 2.5.5/2.5.8) - questi sono i pulsanti di navigazione
           principali dell'header (impostazioni, profilo, info). */
        .header-action-btn { position: absolute; top: 17px; background: rgba(255,255,255,0.2); color: white; border: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; text-decoration: none; }
        .info-btn { right: 20px; }
        .profile-btn { right: 71px; } /* NUOVO - spostato da 65 a 71 per via dell'aumento a 44px sopra, stesso spazio visivo di prima */
        .settings-btn { left: 20px; }

        .day-switch-container { margin-top: 20px; display: flex; justify-content: center; gap: 10px; }
        .day-btn { background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3); color: white; padding: 8px 20px; border-radius: 20px; font-weight: bold; cursor: pointer; font-size: 0.9rem; }
        .day-btn.active { background: white; color: #003366; transform: scale(1.05); }

        /* Contenuti */
        .container { padding: 20px; max-width: 600px; margin: -40px auto 0 auto; position: relative; z-index: 20; box-sizing: border-box; width: 100%; }
        .card { background: white; border-radius: 16px; padding: 20px; margin-bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); box-sizing: border-box; width: 100%; overflow: hidden; }
        .disclaimer-banner { display: flex; align-items: flex-start; gap: 10px; background: #fff8e1; border: 1px solid #ffe082; border-radius: 12px; padding: 12px 14px; margin-bottom: 20px; font-size: 0.78rem; line-height: 1.4; color: #6d5300; }
        .disclaimer-banner i { color: #9c5617; font-size: 1rem; margin-top: 1px; flex-shrink: 0; }
        .card-title { font-weight: 700; margin-bottom: 15px; color: #444; font-size: 0.9rem; text-transform: uppercase; border-bottom: 1px solid #f5f5f5; padding-bottom: 10px; word-break: break-word; }
        
        /* Blu leggermente piu' scuro dell'originale (#3498db/#2980b9): il
           testo bianco 1rem grassetto su quel gradiente arrivava solo a
           ~3.1-4.3:1, sotto il minimo WCAG AA 4.5:1 — questo e' il bottone
           di azione primario dell'app (es. "CHIAMA IL 112", "REGISTRATI").
           Stessa tonalita', verificato 5.30:1 / 6.66:1. */
        .gps-btn { background: linear-gradient(135deg, #2471a3, #1f618d); color: white; border: none; padding: 16px; width: 100%; border-radius: 12px; font-size: 1rem; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; box-sizing: border-box; text-align: center; transition: all 0.3s ease; }
        .gps-btn:hover, .gps-btn:active { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(52, 152, 219, 0.3); }
        .gps-result { margin-top: 20px; text-align: center; display: none; animation: fadeIn 0.5s; }
        
        .fav-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f0; width: 100%; box-sizing: border-box; }
        .fav-name { word-break: break-word; padding-right: 10px; }
        .risk-badge { padding: 4px 10px; border-radius: 6px; color: white; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; text-align: center; min-width: 70px; display: inline-block; }
        
        .add-fav-wrapper { display: flex; gap: 10px; margin-top: 15px; width: 100%; box-sizing: border-box; }
        select { flex-grow: 1; padding: 12px; border-radius: 10px; border: 1px solid #e0e0e0; background: #f9f9f9; font-size: 16px; max-width: 100%; box-sizing: border-box; text-overflow: ellipsis; min-width: 0; }
        .btn-add { background: #2ecc71; color: white; border: none; padding: 0 20px; border-radius: 10px; cursor: pointer; flex-shrink: 0; }

        /* Overlay Comuni (SOS e Info) */
        .sos-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
        .sos-panel { background: rgba(255, 255, 255, 0.95); width: 100%; max-width: 350px; border-radius: 24px; padding: 25px; box-shadow: 0 15px 50px rgba(0,0,0,0.2); text-align: center; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-height: 90vh; overflow-y: auto; box-sizing: border-box; border: 1px solid rgba(255,255,255,0.5); }
        .info-link { color: #003366; text-decoration: none; font-weight: bold; border-bottom: 1px solid #003366; }
        .btn-call-sor { background: linear-gradient(135deg, #e74c3c, #c0392b); color: white; width: 100%; padding: 15px; border-radius: 12px; font-size: 1.1rem; font-weight: bold; text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 15px 0; border: none; box-sizing: border-box; }
        /* Stili per il nuovo pannello Login */
        .login-panel { max-width: 400px; text-align: left; }
        .login-panel .form-row { margin-bottom: 12px; }
        .login-panel .form-row input { font-size: 1rem; }
        .login-panel .link { color: #3498db; cursor: pointer; text-decoration: underline; font-size: 0.9rem; margin-top: 15px; display: inline-block; }
        .btn-call-112 { background: #f1f2f6; color: #2c3e50; width: 100%; padding: 15px; border-radius: 14px; font-size: 1rem; font-weight: bold; text-decoration: none; display: block; text-align: center; margin-bottom: 25px; box-sizing: border-box; }
        .req-btn { background: white; color: #003366; border: 2px solid #003366; padding: 15px; width: 100%; border-radius: 12px; font-size: 0.95rem; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; text-decoration: none; transition: all 0.3s ease; }
        .req-btn:hover, .req-btn:active { background: #eef5ff; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,51,102,0.1); }

        /* Map View SPA */
        #map-view { display: none; height: calc(100vh - 60px); width: 100%; position: absolute; top: 0; left: 0; z-index: 5; background: #eef2f5;}
        #map { height: 100%; width: 100%; z-index: 1; }
        .map-gps-btn { position: absolute; bottom: 30px; right: 15px; z-index: 2000; background: white; border: none; padding: 15px; border-radius: 50%; box-shadow: 0 4px 15px rgba(0,0,0,0.3); cursor: pointer; color: #003366; font-size: 1.3rem; display: flex; align-items: center; justify-content: center; }
        .info-panel { padding: 12px; background: rgba(255,255,255,0.95); position: absolute; top: 10px; left: 10px; z-index: 2000; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); min-width: 140px; max-width: calc(100vw - 110px); box-sizing: border-box; border-left: 5px solid var(--color-primary); }
        .validity-label { font-weight: bold; color: var(--color-primary); text-transform: uppercase; font-size: 10.5px; display: block; letter-spacing: 0.5px; }
        .validity-date { font-weight: 700; font-size: 12px; color: #333; display: block; margin-bottom: 9px; white-space: pre-line; line-height: 1.3; }
        .legenda-item { display: flex; align-items: center; margin-bottom: 5px; font-size: 12px; font-weight: 500; color: #444; }
        .color-box { width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; border: 1px solid rgba(0,0,0,0.1); flex-shrink: 0; }
        
        .logo-overlay { position: absolute; top: 10px; right: 10px; z-index: 2000; background: rgba(255,255,255,0.9); padding: 5px; border-radius: 50%; box-shadow: 0 4px 10px rgba(0,0,0,0.2); pointer-events: none; }
        .logo-overlay img { height: 50px; width: auto; display: block; }
        .day-switch { position: absolute; top: 10px; right: 80px; z-index: 2000; background: white; border-radius: 20px; padding: 4px; box-shadow: 0 4px 15px rgba(0,0,0,0.15); display: flex; }
        .day-switch .day-btn { border: none; background: transparent; padding: 8px 15px; border-radius: 16px; font-weight: bold; cursor: pointer; font-size: 0.85rem; color: #555; transition: 0.2s; transform: none; }
        .day-switch .day-btn.active { background: #003366; color: white; transform: none; }
        .custom-warning-icon { display: flex; align-items: center; justify-content: center; background: transparent; border: none; }

        /* Icone Sensori Personalizzate */
        .custom-sensor-icon { background: transparent; border: none; }
        .sensor-marker { width: 36px; height: 36px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.3); font-size: 12px; transition: transform 0.2s; }
        .area-marker { width: 40px; height: 40px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.4); font-size: 14px; }

        /* Overlay Wearable */
        .ble-panel { background: rgba(255, 255, 255, 0.95); width: 100%; max-width: 400px; border-radius: 24px; padding: 25px; box-shadow: 0 15px 50px rgba(0,0,0,0.2); animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-height: 90vh; overflow-y: auto; box-sizing: border-box; border: 1px solid rgba(255,255,255,0.5); }
        .ble-card { background: #f9f9f9; border-radius: 12px; padding: 15px; margin-bottom: 15px; border: 1px solid #eee; text-align: left; box-sizing: border-box; width: 100%; }
        .ble-btn { width: 100%; padding: 15px; border-radius: 12px; border: none; font-weight: bold; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 5px 0; transition: 0.2s; }
        .ble-btn-primary { background: #3498db; color: white; }
        .ble-btn-active { background: #2ecc71; color: white; }
        .ble-guide { font-size: 0.8rem; color: #666; line-height: 1.4; background: #fff8e1; padding: 10px; border-radius: 8px; border-left: 4px solid #ffc107; margin-bottom: 10px; }

        /* Notifiche Toast */
        #toast-container { position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%); z-index: 9999; width: 90%; max-width: 400px; pointer-events: none; }
        .toast { background: #333; color: white; padding: 12px 20px; border-radius: 12px; margin-bottom: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); font-size: 0.9rem; display: flex; align-items: center; gap: 10px; animation: slideUpToast 0.4s ease-out; opacity: 1; transition: opacity 0.5s; word-break: break-word; }
        .toast.error { border-left: 5px solid #e74c3c; background: #2c3e50; }
        
        @keyframes slideUpToast { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        @keyframes popIn { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }

        .bottom-nav { position: fixed; bottom: 0; width: 100%; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); display: flex; justify-content: space-around; padding: 12px 0; border-top: 1px solid rgba(0,0,0,0.05); z-index: 1000; padding-bottom: env(safe-area-inset-bottom); }
        .nav-item { text-align: center; color: #b0b0b0; text-decoration: none; font-size: 0.7rem; display: flex; flex-direction: column; align-items: center; width: 20%; transition: all 0.3s ease; }
        .nav-item.active { color: #003366; font-weight: 700; transform: translateY(-3px); }
        .nav-item.active i { background: #eef5ff; padding: 6px 16px; border-radius: 20px; color: #3498db; margin-bottom: 2px; transition: 0.3s ease;}
        .nav-item.sos { color: #e74c3c; }
        .nav-item.sos.active i { background: #fdedec; color: #e74c3c; }
        .nav-item i { font-size: 1.4rem; margin-bottom: 4px; }

        /* Colori scuriti rispetto all'originale (#2ecc71/#e67e22/#e74c3c/#95a5a6)
           per rispettare il contrasto minimo WCAG AA 4.5:1 richiesto dal testo
           bianco piccolo (0.75rem) di .risk-badge: sono il livello di rischio
           attuale, il testo piu' safety-critical dell'app. Stessa tonalita'
           percepita, solo piu' scura. Verificato con calcolo di luminanza
           relativa: 5.13:1 / 4.80:1 / 5.44:1 / 4.54:1. */
        .bg-green { background-color: #2e7d32; }
        .bg-yellow { background-color: #f1c40f; color: #333; }
        .bg-orange { background-color: #b8560f; }
        .bg-red { background-color: #c0392b; }
        .bg-unknown { background-color: #767676; }

        /* Offline Banner */
        #offline-banner { background: #e74c3c; color: white; text-align: center; padding: 8px; font-size: 0.85rem; font-weight: bold; position: fixed; top: 0; left: 0; width: 100%; z-index: 10000; display: none; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
        #stale-data-banner { background: #c0392b; color: white; text-align: center; padding: 8px; font-size: 0.85rem; font-weight: bold; position: fixed; top: 0; left: 0; width: 100%; z-index: 9999; display: none; box-shadow: 0 2px 10px rgba(0,0,0,0.3); }
        /* Se anche l'app e' offline, il banner offline (piu' urgente, sopra) copre questo */
        body:has(#offline-banner[style*="display: block"]) #stale-data-banner { top: 34px; }
        .dati-non-freschi #map { filter: grayscale(1); }

        /* Banner promozione APK (vedi js/apk-banner.js): in basso, non urgente
           come gli avvisi sopra, quindi niente z-index/posizione in conflitto
           con offline-banner/stale-data-banner che restano in alto. */
        #pwa-apk-banner {
            display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9998;
            background: #003366; color: white; padding: 10px 14px;
            padding-bottom: max(10px, env(safe-area-inset-bottom));
            align-items: center; gap: 10px; box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
            font-size: 0.82rem;
        }
        #pwa-apk-banner.attivo { display: flex; }
        #pwa-apk-banner i.fa-google-play { font-size: 1.3rem; color: #f1c40f; flex-shrink: 0; }
        #pwa-apk-banner .pwa-apk-testo { flex: 1; line-height: 1.3; }
        #pwa-apk-banner a.pwa-apk-cta {
            background: #f1c40f; color: #003366; text-decoration: none; font-weight: 800;
            padding: 7px 12px; border-radius: 8px; font-size: 0.78rem; white-space: nowrap;
        }
        #pwa-apk-banner .pwa-apk-chiudi {
            background: none; border: none; color: white; opacity: 0.7; font-size: 1rem;
            cursor: pointer; padding: 4px; flex-shrink: 0;
        }

        /* Banner consenso cookie (vedi js/cookie-consent.js): stesso stile del
           banner APK sopra, riusa le classi .pwa-apk-testo/.pwa-apk-cta/
           .pwa-apk-chiudi per coerenza visiva. Se sono entrambi attivi (raro:
           serve sia un Play Store URL sia un GA ID reale configurati), il
           banner cookie sta sotto e sposta su quello APK, cosi' non si
           sovrappongono. */
        #cookie-consent-banner {
            display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 9997;
            background: #003366; color: white; padding: 10px 14px;
            padding-bottom: max(10px, env(safe-area-inset-bottom));
            align-items: center; gap: 10px; box-shadow: 0 -2px 12px rgba(0,0,0,0.25);
            font-size: 0.82rem;
        }
        #cookie-consent-banner.attivo { display: flex; }
        #cookie-consent-banner i { font-size: 1.3rem; color: #f1c40f; flex-shrink: 0; }
        #cookie-consent-banner .pwa-apk-testo a { color: #f1c40f; }
        body.cookie-banner-attivo #pwa-apk-banner { bottom: 54px; }
        /* Regole di comportamento: a sinistra, accanto alle impostazioni. Prima stava a right:65px, quasi sopra l'account (right:71px), e con tre pulsanti a destra non c'era posto accanto al logo sugli schermi stretti. */
        .rules-btn { right: auto; left: 71px; background: #e67e22; color: white; border: none; }

        /* Avvisi Comunali */
        .avviso-card { background: #fdfdfd; border-left: 4px solid #3498db; padding: 12px; margin-bottom: 10px; border-radius: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); text-align: left; }
        .avviso-card.info { border-left-color: #3498db; }
        .avviso-card.yellow { border-left-color: #f1c40f; background: #fffdf5; }
        .avviso-card.orange { border-left-color: #e67e22; background: #fffaf0; }
        .avviso-card.alert { border-left-color: #e74c3c; background: #fff5f5; }
        .avviso-date { font-size: 0.7rem; color: #6b6b6b; margin-bottom: 4px; display:block; font-weight:bold; }
        .avviso-title { font-weight: bold; margin: 0 0 5px 0; font-size: 0.95rem; color: #333; }
        .avviso-text { font-size: 0.85rem; color: #555; margin: 0; line-height: 1.4; }
        .btn-avvisi { background: #2471a3; color: white; border: none; padding: 8px 15px; border-radius: 20px; font-size: 0.75rem; font-weight: bold; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 5px; margin-top: 10px; text-decoration: none; width: 100%; box-sizing: border-box; transition: 0.2s; }
        .btn-avvisi.has-alerts { background: #e74c3c !important; color: white !important; animation: pulseAvviso 2s infinite; }
        .btn-share-avviso { background: none; border: none; color: #6b6b6b; cursor: pointer; font-size: 1.1rem; padding: 5px; transition: 0.2s; margin-top: -5px; }
        .btn-share-avviso:hover, .btn-share-avviso:active { color: #3498db; transform: scale(1.1); }
        .sos-panel ul {
            margin: 0;
            padding-left: 20px;
        }
        .sos-panel ul li {
            margin-bottom: 8px;
        }
        @keyframes pulseAvviso { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
        .risk-info-section { display: none; }
        .risk-info-section h4 { margin-top: 0; }
        .risk-info-section h5 { margin: 20px 0 8px 0; color: #003366; font-size: 1rem; border-bottom: 1px solid #eee; padding-bottom: 5px; display: flex; align-items: center; }
        .risk-info-section h6 { margin: 10px 0 5px 0; color: #555; font-size: 0.9rem; }
        .risk-info-section p { margin: 0 0 15px 0; font-size: 0.85rem; line-height: 1.5; color: #444; }
        /* Animazione icone */
        @keyframes iconPopIn {
            0% { transform: scale(0.5); opacity: 0; }
            70% { transform: scale(1.1); opacity: 1; }
            100% { transform: scale(1); opacity: 1; }
        }
        .icon-animated {
            animation: iconPopIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
        }
        /* Effetti cliccabili */
        .clickable-effect {
            color: #003366;
            font-weight: 600;
            text-decoration: none;
            border-bottom: 1px dotted #003366;
            cursor: pointer;
        }
        .clickable-effect:hover { background-color: #eef5ff; }

        /* Form Piano Familiare */
        /* Chatbot CSS */
        #chatbot-button { position: fixed; bottom: 85px; left: 20px; right: auto; z-index: 9999; background: #003366; width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(0,0,0,0.3); cursor: pointer; transition: transform 0.3s; color: white; font-size: 1.8rem; }
        @keyframes floatBot { 0%, 100% { transform: translateY(0); box-shadow: 0 4px 15px rgba(0,0,0,0.3); } 50% { transform: translateY(-6px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); } }
        #chatbot-button { animation: floatBot 3s infinite ease-in-out; }
        #chatbot-button:hover { transform: scale(1.1); }
        .chatbot-image-icon { width: 45px; height: 45px; object-fit: contain; }
        #chatbot-panel { position: fixed; bottom: 160px; left: 20px; right: auto; width: 340px; height: 450px; max-height: 70vh; background: white; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); display: flex; flex-direction: column; z-index: 9998; transform: translateY(20px); opacity: 0; pointer-events: none; transition: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); overflow: hidden; border: 1px solid #eee; }
        #chatbot-panel.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
        .chatbot-header { background: #003366; color: white; padding: 15px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
        .chatbot-header button { background: none; border: none; color: white; font-size: 1.5rem; cursor: pointer; transition: 0.2s; }
        .chatbot-header button:hover { transform: scale(1.1); }
        .chatbot-messages { flex-grow: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background: #f4f6f8; scroll-behavior: smooth; }
        .chatbot-message { max-width: 85%; padding: 10px 15px; border-radius: 15px; font-size: 0.9rem; line-height: 1.4; word-wrap: break-word; }
        .chatbot-message.bot { background: linear-gradient(135deg, #ffffff 0%, #f0f4f8 100%); color: #333; align-self: flex-start; border-bottom-left-radius: 5px; box-shadow: 0 4px 10px rgba(0,0,0,0.05); border: 1px solid #e1e8ed; }
        .chatbot-message.user { background: linear-gradient(135deg, #2471a3 0%, #1f618d 100%); color: white; align-self: flex-end; border-bottom-right-radius: 5px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
        .chatbot-input-container { display: flex; padding: 10px; background: white; border-top: 1px solid #eee; }
        .chatbot-input-container .btn-mic { background: #f0f2f5; color: #e74c3c; margin-right: 5px; }
        #chatbot-input { flex-grow: 1; padding: 10px 15px; border: 1px solid #ddd; border-radius: 20px; outline: none; font-family: inherit; font-size: 0.9rem; }
        #chatbot-input:focus-visible { outline: 2px solid #2471a3; outline-offset: 1px; }

        /* Indicatore di focus visibile per i div/span resi interattivi con
           tabindex (voci di legenda, elementi del kit, e i loro equivalenti
           in formazione.css): senza, un utente da tastiera non vede mai
           dove si trova, perche' un <div> non ha un focus ring di default
           come un <button>. */
        .legenda-item:focus-visible, .kit-item:focus-visible {
            outline: 2px solid #2471a3; outline-offset: 2px; border-radius: 4px;
        }
        .chatbot-input-container button { background: #003366; color: white; border: none; width: 40px; height: 40px; border-radius: 50%; margin-left: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; transition: 0.2s; }
        .chatbot-input-container button:active { transform: scale(0.9); }
        .chatbot-quick-replies { display: flex; gap: 8px; padding: 10px 15px; overflow-x: auto; white-space: nowrap; border-top: 1px solid #eee; background: white; scrollbar-width: none; }
        .chatbot-quick-replies::-webkit-scrollbar { display: none; }
        .chatbot-quick-replies button { background: #eef5ff; color: #003366; border: 1px solid #cce0ff; padding: 6px 12px; border-radius: 15px; font-size: 0.8rem; cursor: pointer; transition: 0.2s; flex-shrink: 0; font-family: inherit; font-weight: 600; }
        .chatbot-quick-replies button:hover { background: #cce0ff; }
        /* Typing indicator */
        .typing-indicator { display: flex; gap: 4px; padding: 5px; align-items: center; height: 20px; }
        .typing-dot { width: 6px; height: 6px; background: #999; border-radius: 50%; animation: typing 1.4s infinite ease-in-out; }
        .typing-dot:nth-child(1) { animation-delay: 0s; }
        .typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .typing-dot:nth-child(3) { animation-delay: 0.4s; }
        @keyframes typing { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
        /* Feedback Bot */
        .chatbot-feedback { display: flex; gap: 10px; margin-top: 8px; justify-content: flex-end; border-top: 1px solid #f0f0f0; padding-top: 5px; }
        .chatbot-feedback button { background: none; border: none; color: #aaa; cursor: pointer; font-size: 0.9rem; transition: 0.2s; padding: 0; }
        .chatbot-feedback button:hover { color: #3498db; transform: scale(1.2); }
        .chatbot-feedback-msg { font-size: 0.75rem; color: #2ecc71; font-weight: bold; animation: popIn 0.3s; }
        .bot-avatar-sm { width: 26px; height: 26px; background: #003366; border-radius: 50%; padding: 4px; object-fit: contain; flex-shrink: 0; box-shadow: 0 2px 5px rgba(0,0,0,0.15); }
        .bot-msg-wrapper { display: flex; gap: 8px; align-items: flex-end; }
        /* Impaginazione delle risposte del bot: il backend restituisce HTML
           (paragrafi/elenchi/link), qui serve solo lo spacing visivo. */
        .chatbot-message.bot p { margin: 0 0 8px 0; }
        .chatbot-message.bot p:last-child { margin-bottom: 0; }
        .chatbot-message.bot ul, .chatbot-message.bot ol { margin: 0 0 8px 0; padding-left: 20px; }
        .chatbot-message.bot ul:last-child, .chatbot-message.bot ol:last-child { margin-bottom: 0; }
        .chatbot-message.bot li { margin-bottom: 4px; }
        .chatbot-message.bot a { color: #2980b9; font-weight: 600; text-decoration: underline; }
        
        @keyframes pulseMic { 0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); } 70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); } 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); } }
        .mic-listening { animation: pulseMic 1.5s infinite; background: #e74c3c !important; color: white !important; }
        @media (max-width: 768px) {
            #chatbot-panel { bottom: 0; right: 0; left: 0; width: 100%; height: 85dvh; max-height: 85dvh; border-radius: 20px 20px 0 0; z-index: 10000; box-sizing: border-box; border: none; box-shadow: 0 -5px 25px rgba(0,0,0,0.3); }
            #chatbot-button { bottom: 75px; left: 15px; right: auto; width: 55px; height: 55px; }
        }
        .form-row { margin-bottom: 10px; text-align:left; }
        .form-row label { display:block; font-size:0.8rem; font-weight:bold; color:#003366; margin-bottom:4px; }
        .form-row input { width:100%; padding:10px; border-radius:8px; border:1px solid #ddd; box-sizing:border-box; font-family:inherit; }
        .family-list { list-style:none; padding:0; margin:10px 0; max-height:120px; overflow-y:auto; border:1px solid #eee; border-radius:8px; }
        .family-list li { display:flex; justify-content:space-between; padding:8px 10px; border-bottom:1px solid #f9f9f9; font-size:0.85rem; }
        .family-list li:last-child { border-bottom:none; }
        .kit-list { display:grid; grid-template-columns: 1fr 1fr; gap:10px; text-align:left; margin-top:10px; }
        .kit-item { background:#f4f6f8; padding:8px; border-radius:8px; font-size:0.8rem; display:flex; align-items:center; gap:8px; cursor:pointer; border:1px solid transparent; }
        .kit-item.checked { background:#eef9f2; border-color:#2ecc71; font-weight:bold; color:#27ae60; }

        /* Stili Livelli Mappa */
        .layer-btn { width:100%; display:block; text-align:left; background:#f4f6f8; border:1px solid #ddd; padding:10px; border-radius:8px; margin-bottom:8px; font-weight:bold; color:#444; cursor:pointer; transition:0.2s; box-sizing: border-box; }
        .layer-btn:hover { border-color: var(--color-accent); background: #eef5ff; }
        .layer-btn.active-bollettino { background: var(--color-primary); color:white; border-color:#001f3f; }
        .layer-btn.active { background:#3498db; color:white; border-color:#2980b9; }
        .layer-btn.active-radar { background:#9b59b6; color:white; border-color:#8e44ad; }
        .layer-btn.active-aree { background:#27ae60; color:white; border-color:#2ecc71; }
        .layer-btn.active-sismico { background:#c0392b; color:white; border-color:#922b21; }
        .layer-btn.active-seveso { background:#34495e; color:white; border-color:#2c3e50; }
        .layer-btn.active-frane { background:#a0522d; color:white; border-color:#7a3d20; }
        .layer-btn.active-idranti { background:#d35400; color:white; border-color:#a04000; }
        .layer-btn.active:hover, .layer-btn.active-radar:hover, .layer-btn.active-aree:hover,
        .layer-btn.active-sismico:hover, .layer-btn.active-seveso:hover, .layer-btn.active-frane:hover,
        .layer-btn.active-bollettino:hover, .layer-btn.active-idranti:hover { filter: brightness(1.08); }
        .layer-btn i { margin-right:5px; }
        .layer-panel-divider { font-size:0.7rem; text-transform:uppercase; font-weight:800; color: #717171; letter-spacing:0.5px; margin:12px 0 8px 0; padding-top:8px; border-top:1px dashed #ddd; }

        /* Marker hazard (mappa multirischio: Seveso, ecc.) - stesso schema
           visivo di .sensor-marker/.area-marker sopra, colore hazard scuro. */
        .hazard-marker { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; border: 2px solid white; box-shadow: 0 2px 5px rgba(0,0,0,0.3); font-size: 14px; }
        .hazard-marker.hazard-seveso { background: #34495e; }
    