:root { 
            --primary-green: #006633; --secondary-gold: #fbc02d; 
            --bg-glass: rgba(15, 23, 42, 0.65);
            --font-main: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif; 
            --font-display: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
            --font-tailwind: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
        }
        
        *:not(i) { box-sizing: border-box; }
        i { box-sizing: border-box; }
        
        body:not(.admin-body):not(.staff-body):not(.pager-body) { 
            margin: 0; padding: 0; height: 100vh; overflow: hidden; 
            background: url('https://www.lavoro.provincia.lecco.it/.galleries/immagini/Sfondi/sfondo.webp') no-repeat center center fixed; 
            background-size: cover; 
            font-family: var(--font-main);
            /* Ottimizzazioni Touch / Kiosk */
            -webkit-user-select: none; -moz-user-select: none; user-select: none; -webkit-touch-callout: none;
            -webkit-tap-highlight-color: transparent; touch-action: manipulation;
        }
        
        body.admin-body {
            margin: 0; padding: 0; min-height: 100vh; overflow-x: hidden; overflow-y: auto;
            background: #f8fafc;
            font-family: var(--font-tailwind);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        body.staff-body {
            margin: 0; padding: 0; height: 100vh; max-height: 100vh; overflow: hidden;
            background: #f8fafc;
            font-family: var(--font-tailwind);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }

        body.pager-body {
            margin: 0; padding: 0; height: 100vh; max-height: 100vh; overflow: hidden;
            background: #0f172a;
            font-family: var(--font-tailwind);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
        body.admin-body *:not(i):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fab"]),
        body.staff-body *:not(i):not([class*="fa-"]):not([class*="fas"]):not([class*="far"]):not([class*="fab"]) {
            font-family: var(--font-tailwind);
        }
        
        .client-body { 
            background: linear-gradient(135deg, #0a3d3c, #005c4b, #003b5c, #0f2027, #005c4b);
            background-size: 300% 300%;
            animation: slowSmoothBG 50s ease-in-out infinite;
            color: white;
        }
        
        .totem-body {
            background: linear-gradient(-45deg, #002171, #004d40, #0d47a1, #003300);
            background-size: 250% 250%;
            animation: slowSmoothTotem 35s ease-in-out infinite; 
            color: white;
        }

        @keyframes slowSmoothBG {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        @keyframes slowSmoothTotem {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }
        
        .lang-container {
            position: absolute; top: 30px; right: 40px; z-index: 2000;
            display: flex; align-items: center; gap: 20px;
            background: rgba(255,255,255,0.95); padding: 12px 25px;
            border-radius: 50px; box-shadow: 0 10px 30px rgba(0,0,0,0.15);
            border: 2px solid white;
        }
        .lang-main-label { font-size: 15px; font-weight: 800; color: #333; text-transform: uppercase; border-right: 2px solid #ddd; padding-right: 20px; }
        .lang-options { display: flex; gap: 15px; }
        .lang-btn { display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; opacity: 0.4; transition: all 0.3s; }
        .lang-flag { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 10px rgba(0,0,0,0.1); border: 3px solid transparent; transition: 0.3s; }
        .lang-text { font-size: 13px; font-weight: 800; color: #555; }
        .lang-btn.active { opacity: 1; transform: scale(1.1); }
        .lang-btn.active .lang-flag { border-color: var(--primary-green); box-shadow: 0 6px 15px rgba(0,102,51,0.3); }
        .lang-btn:hover { opacity: 0.8; }

        .admin-wrapper { background: #f4f7f6; width: 100%; height: 100%; overflow-y: auto; padding: 40px; position: relative; }
        .admin-card { background: white; padding: 30px; border-radius: 24px; border: none; box-shadow: 0 15px 35px rgba(0,0,0,0.06); margin-bottom: 25px; max-width: 1100px; margin-left: auto; margin-right: auto; }
        .admin-h1 { color: var(--primary-green); text-align: center; font-weight: 900; margin-bottom: 30px; font-size: 2.5rem; letter-spacing: -1px; }
        .btn-act { padding: 6px 12px; font-size: 12px; font-weight: 800; border: none; border-radius: 8px; cursor: pointer; color: white; margin-right: 4px; display:inline-flex; align-items:center; justify-content:center; min-width:35px; text-transform:uppercase; transition: 0.2s; }
        .btn-act:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.15); }
        .btn-green { background: #006633; } .btn-blue { background: #1565c0; } .btn-red { background: #e53935; } .btn-gray { background: #78909c; font-size: 14px; }
        .btn-save { padding: 12px 25px; background: var(--primary-green); color: white; font-weight: 800; font-size: 14px; border:none; border-radius: 12px; cursor:pointer; transition: 0.2s; box-shadow: 0 4px 15px rgba(0,102,51,0.2); }
        .btn-save:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,102,51,0.3); }
        .admin-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 15px; }
        .admin-table th { text-align: left; padding: 15px; border-bottom: 2px solid #e0e0e0; font-size: 13px; font-weight: 800; text-transform: uppercase; color: #888; }
        .admin-table td { padding: 15px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; color: #444; font-weight: 600; }
        .count-badge { background: #f0f0f0; color: #333; padding: 6px 12px; border-radius: 20px; font-weight: 900; font-size: 13px; }
        input[type="text"], select { width: 100%; padding: 12px 15px; border: 2px solid #eaeaea; border-radius: 10px; font-size: 14px; font-weight: 600; color: #333; transition: 0.3s; background: #fafafa; }
        input[type="text"]:focus, select:focus { border-color: var(--primary-green); outline: none; background: white; }
        input[type="color"] { -webkit-appearance: none; border: none; width: 45px; height: 45px; cursor: pointer; border-radius: 50%; overflow: hidden; padding: 0; background: none; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
        input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
        input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
        
        .admin-tabs { display: flex; gap: 15px; justify-content: center; margin-bottom: 25px; }
        .tab-btn { padding: 12px 30px; background: white; border: none; border-radius: 12px; font-size: 15px; font-weight: 800; color: #888; cursor: pointer; transition: all 0.3s; box-shadow: 0 4px 10px rgba(0,0,0,0.05); text-transform: uppercase; }
        .tab-btn:hover { color: var(--primary-green); transform: translateY(-2px); }
        .tab-btn.active { background: var(--primary-green); color: white; box-shadow: 0 6px 15px rgba(0,102,51,0.2); }
        .tab-content { display: none; animation: fadeIn 0.4s ease-out; }
        .tab-content.active { display: block; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

        .overlay { position: absolute; top:0; left:0; width:100%; height:100%; background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(0,0,0,0.05)); z-index: 1; pointer-events: none;}

        .top-bar { 
            position: fixed; top: 0; left: 0; width: 100%; height: 11vh; 
            background: rgba(255,255,255,0.95); backdrop-filter: blur(25px); z-index: 10; 
            display: flex; align-items: center; justify-content: space-between; 
            padding: 0 4vw; border-bottom: 1px solid rgba(0,0,0,0.05);
            box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
        }
        .bar-left { display: flex; align-items: center; gap: 1.5vw; }
        .inst-logo { max-height: 6.5vh; width: auto; object-fit: contain;}
        
        .bar-right { display: flex; justify-content: flex-end; align-items: center; }
        
        .widget-box { 
            display: flex; align-items: center; gap: 1.5vw; 
        }
        .widget-weather { display: flex; align-items: center; gap: 0.5vw; font-size: 1.8vw; font-weight: 800; color: #475569; border-right: 2px solid #cbd5e1; padding-right: 1.5vw; }
        .weather-icon { font-size: 1.8vw; }
        .time-box { display: flex; flex-direction: column; align-items: flex-end; justify-content: center;}
        .widget-time { font-size: 2.2vw; font-weight: 900; line-height: 1; color: var(--primary-green); letter-spacing: -1px; font-family: var(--font-display) !important; text-shadow: none; }
        .widget-date { font-size: 0.85vw; font-weight: 700; text-transform: uppercase; color: #94a3b8; margin-top: 2px;}

        .client-container { 
            position: relative; z-index: 2; display: flex; width: 100%; height: 89vh; margin-top: 11vh;
            padding: 5vh 3vw; gap: 3vw; align-items: stretch; justify-content: space-between; 
        }
        
        .glass-panel {
            background: rgba(255, 255, 255, 0.15); 
            backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
            border: 1px solid rgba(255,255,255,0.3);
            box-shadow: 0 30px 80px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2); 
        }
        
        .main-box { 
            flex: 1.8; border-radius: 4vh;
            display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; 
            padding: 3vh 2vw; 
        }
        
        .label-top { 
            font-size: 2vw; color: #475569; font-weight: 800; text-transform: uppercase; 
            letter-spacing: 8px; margin: 0; text-shadow: none;
        }
        
        .ticket-wrapper {
            background: rgba(255,255,255,0.95); border-radius: 4vh; padding: 4vh 2vw; width: 90%;
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; 
            box-shadow: 0 25px 60px rgba(0,0,0,0.2);
        }
        
        .number-container { display: flex; align-items: center; justify-content: center; gap: 1vw; }
        .big-char { font-family: var(--font-display) !important; font-size: 21vw; font-weight: 900; line-height: 0.9; letter-spacing: normal; color: #1e293b; text-shadow: none; }
        .big-digit { font-family: var(--font-display) !important; font-size: 21vw; font-weight: 900; line-height: 0.9; color: #1e293b; letter-spacing: normal; text-shadow: none; }
        
        .desk-badge { 
            padding: 2vh 5vw; border-radius: 5vh; font-size: 3vw; font-weight: 900; text-transform: uppercase; 
            letter-spacing: 3px; border: 1px solid rgba(255,255,255,0.2); margin: 0;
            box-shadow: 0 15px 35px rgba(0,0,0,0.4); font-family: var(--font-display) !important;
            transition: all 0.5s ease;
        }
        
        .history-column { 
            flex: 1; border-radius: 3vh; padding: 4vh 2vw;
            display: flex; flex-direction: column;
        }
        
        .history-title { 
            color: white; font-size: 2vw; font-weight: 900; text-transform: uppercase; 
            margin-bottom: 2vh; text-align: center; border-bottom: 2px solid rgba(255,255,255,0.2); 
            padding-bottom: 2vh; letter-spacing: 2px; text-shadow: 0 2px 10px rgba(0,0,0,0.3);
        }
        
        .history-list { 
            list-style: none; padding: 0; margin: 0; overflow: hidden; 
            display: flex; flex-direction: column; gap: 2vh; flex-grow: 1; justify-content: flex-start;
        }
        
        .history-card { 
            background: rgba(255,255,255,0.9); border-radius: 2vh; padding: 1.5vh 2vw; 
            display: flex; justify-content: space-between; align-items: center; 
            box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-left: 1vw solid #ccc; 
            border-top: 1px solid white; border-bottom: none; border-right: none;
            transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            flex-shrink: 0; 
        }
        .history-card:first-child { transform: scale(1.03); box-shadow: 0 15px 40px rgba(0,0,0,0.2); background: white; border-left-width: 1.2vw;}
        
        .h-num { font-family: var(--font-display) !important; font-size: 4vw; font-weight: 900; color: #1e293b; line-height: 1; margin-right: 1vw; text-shadow: none;}
        
        .h-desk { 
            font-size: 1.3vw; font-weight: 800; color: white; 
            text-transform: uppercase; background: #94a3b8; 
            padding: 1vh 1.5vw; border-radius: 1.5vh; 
            text-align: center; min-width: 10vw; letter-spacing: 1px;
            box-shadow: 0 4px 10px rgba(0,0,0,0.1);
        }
        
        .audio-start-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.9); z-index:999; display:flex; justify-content:center; align-items:center; cursor:pointer; backdrop-filter: blur(10px); }
        .audio-btn-big { font-size:35px; color:white; border:4px solid var(--primary-green); padding:40px 60px; border-radius:30px; text-transform:uppercase; font-weight:900; background:rgba(0,102,51,0.2); box-shadow: 0 20px 50px rgba(0,0,0,0.5); transition: 0.3s; }
        .audio-btn-big:hover { background: var(--primary-green); transform: scale(1.05); }

        /* ========================================================= */
        /* RESTYLING TOTEM KIOSK: SUITE PULITA & FLUIDA              */
        /* ========================================================= */
        .totem-body {
            background: linear-gradient(135deg, #001f3f 0%, #004d40 25%, #002855 50%, #004d26 75%, #0f172a 100%);
            background-size: 350% 350%;
            animation: slowSmoothTotemMesh 120s ease-in-out infinite; 
            color: white;
            user-select: none;
            -webkit-user-select: none;
        }

        @keyframes slowSmoothTotemMesh {
            0% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
            100% { background-position: 0% 50%; }
        }

        /* ========================================================= */
        /* RESTYLING TOTEM KIOSK: CARD AL CENTRO E LINGUA SUL FONDO  */
        /* ========================================================= */
        .totem-wrapper { 
            position: relative; z-index: 2; height: 100vh; max-height: 100vh; overflow: hidden; 
            display: flex; flex-direction: column; justify-content: space-between; align-items: center; 
            text-align: center; padding: 1.5vh 2vw 1.5vh 2vw;
            box-sizing: border-box;
        }

        .totem-card { 
            background: rgba(255,255,255,0.95); backdrop-filter: blur(50px); -webkit-backdrop-filter: blur(50px); 
            padding: 2.2vh 2.5vw 2.2vh 2.5vw; border-radius: 42px; 
            box-shadow: 0 30px 90px rgba(0,0,0,0.35), inset 0 2px 4px rgba(255,255,255,0.8); 
            border: 3.5px solid rgba(14, 28, 54, 0.85); width: 98%; max-width: 1550px; 
            display: flex; flex-direction: column; align-items: center; justify-content: space-between;
            max-height: calc(100vh - 110px);
            margin-top: auto; margin-bottom: auto;
            transition: all 0.3s ease;
            box-sizing: border-box;
            overflow-y: auto;
            scrollbar-width: none;
        }
        .totem-card::-webkit-scrollbar { display: none; }

        .totem-header-wrap {
            margin-bottom: 1.2vh;
            flex-shrink: 0;
        }
        .totem-main-title {
            color: var(--primary-green);
            font-weight: 900;
            font-size: clamp(2.2rem, 3.5vw, 3.4rem);
            margin: 0 0 2px 0;
            text-transform: uppercase;
            letter-spacing: -0.5px;
            line-height: 1.1;
        }
        .totem-sub-title {
            color: #64748b;
            font-size: clamp(1.1rem, 1.5vw, 1.35rem);
            margin: 0;
            font-weight: 700;
            letter-spacing: 0.5px;
        }
        
        /* Griglia Adattiva Base */
        .totem-grid { 
            display: grid; 
            grid-template-columns: repeat(2, 1fr);
            gap: 2vw; 
            margin-top: 1.2vh; 
            width: 100%; 
            align-items: stretch;
            flex: 1;
        }

        /* Adattamento Layout in base al numero di servizi */
        /* 1 solo servizio */
        .totem-grid.totem-count-1 {
            grid-template-columns: 1fr;
            max-width: 750px;
            margin-left: auto;
            margin-right: auto;
        }
        .totem-grid.totem-count-1 .totem-btn {
            min-height: 280px;
            padding: 3vh 3.5vw;
        }

        /* 2 servizi: layout standard orizzontale affiancato */
        .totem-grid.totem-count-2 {
            grid-template-columns: repeat(2, 1fr);
            gap: 2.5vw;
        }
        .totem-grid.totem-count-2 .totem-btn {
            min-height: 260px;
            padding: 2.8vh 2.8vw;
        }

        /* 3 servizi: 3 colonne affiancate su schermi larghi */
        .totem-grid.totem-count-3 {
            grid-template-columns: repeat(3, 1fr);
            gap: 1.8vw;
        }
        .totem-grid.totem-count-3 .totem-btn {
            min-height: 225px;
            padding: 2vh 1.8vw 1.6vh 1.8vw;
            border-radius: 32px;
        }
        .totem-grid.totem-count-3 .prefix-bubble {
            width: 76px; height: 76px; font-size: 42px; border-radius: 22px;
        }
        .totem-grid.totem-count-3 .totem-logo {
            max-height: 76px;
        }
        .totem-grid.totem-count-3 .totem-btn-title {
            font-size: clamp(1.8rem, 2.6vw, 2.9rem);
        }

        /* 4 servizi: griglia 2x2 ben dimensionata ed espansa */
        .totem-grid.totem-count-4 {
            grid-template-columns: repeat(2, 1fr);
            gap: 2vh 2.2vw;
        }
        .totem-grid.totem-count-4 .totem-btn {
            min-height: 195px;
            padding: 2.2vh 2.2vw 1.8vh 2.2vw;
            border-radius: 32px;
            gap: 12px;
        }
        .totem-grid.totem-count-4 .prefix-bubble {
            width: 72px; height: 72px; font-size: 40px; border-radius: 20px; margin-bottom: 2px;
            box-shadow: 0 12px 28px rgba(0,0,0,0.22);
        }
        .totem-grid.totem-count-4 .totem-logo {
            max-height: 68px;
        }
        .totem-grid.totem-count-4 .totem-btn-title {
            font-size: clamp(1.9rem, 2.7vw, 2.9rem);
            font-weight: 900;
            line-height: 1.15;
            padding: 4px 8px;
            letter-spacing: 0.6px;
        }
        .totem-grid.totem-count-4 .totem-queue-pill {
            padding: 7px 16px;
            font-size: 15px;
            border-radius: 999px;
        }
        .totem-grid.totem-count-4 .totem-queue-pill .totem-queue-count-badge {
            font-size: 14px;
            padding: 3px 8px;
        }
        .totem-grid.totem-count-4 .touch-finger-icon {
            width: 46px;
            height: 46px;
        }

        /* 5 o 6 servizi: griglia 3 colonne x 2 righe */
        .totem-grid.totem-count-5,
        .totem-grid.totem-count-6 {
            grid-template-columns: repeat(3, 1fr);
            gap: 1.4vh 1.6vw;
        }
        .totem-grid.totem-count-5 .totem-btn,
        .totem-grid.totem-count-6 .totem-btn {
            min-height: 165px;
            padding: 1.6vh 1.4vw 1.2vh 1.4vw;
            border-radius: 26px;
            gap: 8px;
        }
        .totem-grid.totem-count-5 .prefix-bubble,
        .totem-grid.totem-count-6 .prefix-bubble {
            width: 60px; height: 60px; font-size: 32px; border-radius: 16px; margin-bottom: 2px;
        }
        .totem-grid.totem-count-5 .totem-logo,
        .totem-grid.totem-count-6 .totem-logo {
            max-height: 54px;
        }
        .totem-grid.totem-count-5 .totem-btn-title {
            font-size: clamp(1.4rem, 2vw, 2.1rem);
            line-height: 1.12;
            padding: 2px;
        }
        .totem-grid.totem-count-6 .totem-btn-title {
            font-size: clamp(1.4rem, 2vw, 2.1rem);
            line-height: 1.12;
            padding: 2px;
        }
        .totem-grid.totem-count-5 .totem-queue-pill,
        .totem-grid.totem-count-6 .totem-queue-pill {
            padding: 4px 10px;
            font-size: 12px;
        }
        .totem-grid.totem-count-5 .touch-finger-icon,
        .totem-grid.totem-count-6 .touch-finger-icon {
            width: 32px;
            height: 32px;
        }

        /* Più di 6 servizi: griglia 3 o 4 colonne scorrevole se necessario */
        .totem-grid.totem-count-many {
            grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
            gap: 1.2vh 1.2vw;
        }
        .totem-grid.totem-count-many .totem-btn {
            min-height: 140px;
            padding: 1.2vh 1.2vw 1vh 1.2vw;
            border-radius: 20px;
            gap: 6px;
        }
        .totem-grid.totem-count-many .prefix-bubble {
            width: 46px; height: 46px; font-size: 24px; border-radius: 12px;
        }
        .totem-grid.totem-count-many .totem-btn-title {
            font-size: clamp(1.1rem, 1.6vw, 1.7rem);
        }
        
        /* PULSANTI SERVIZI 3D GLASSMORPHISM - ALTEZZA E POSIZIONE PERFETTE */
        .totem-btn { 
            border: none; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 10px; 
            padding: 2.2vh 2.2vw 1.8vh 2.2vw; width: 100%; height: 100%; min-height: 190px; border-radius: 34px; color: white; 
            font-family: var(--font-display) !important;
            box-shadow: 0 16px 40px rgba(0,0,0,0.28), inset 0 2px 0 rgba(255,255,255,0.55), inset 0 -4px 0 rgba(0,0,0,0.25); 
            transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1); cursor: pointer; position: relative; overflow: hidden; 
            text-shadow: 0 2px 8px rgba(0,0,0,0.4);
            touch-action: none;
            animation: gentle-float 4s infinite ease-in-out;
            box-sizing: border-box;
        }
        .totem-btn * { pointer-events: none; }
        .totem-btn::before { 
            content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 50%; 
            background: linear-gradient(180deg, rgba(255,255,255,0.38) 0%, rgba(255,255,255,0) 100%); 
            border-radius: 36px 36px 120px 120px; pointer-events: none; 
        }
        .totem-btn.pressed { 
            transform: scale(0.94) translateY(8px); 
            box-shadow: 0 6px 14px rgba(0,0,0,0.35), inset 0 10px 20px rgba(0,0,0,0.45); 
            animation: none; filter: brightness(0.92); transition: all 0.05s; 
        }

        .totem-btn-title {
            font-size: clamp(2rem, 3.4vw, 3.8rem);
            font-weight: 900;
            line-height: 1.15;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex: 1;
            width: 100%;
            padding: 0.3vh 0.4vw;
        }

        /* Effetto Ripple Luminoso Touch */
        .ripple-wave {
            position: absolute; border-radius: 50%;
            background: radial-gradient(circle, rgba(255,255,255,0.85) 0%, rgba(255,255,255,0) 70%);
            transform: scale(0); animation: rippleEffect 0.65s linear; pointer-events: none;
        }
        @keyframes rippleEffect {
            to { transform: scale(4); opacity: 0; }
        }

        .totem-logo { filter: drop-shadow(0 8px 18px rgba(0,0,0,0.3)); max-height: 85px; width: auto; object-fit: contain; margin-bottom: 4px; }
        
        .prefix-bubble { 
            width: 82px; height: 82px; background: rgba(255,255,255,0.98); color: #0f172a; 
            border-radius: 26px; display: flex; align-items: center; justify-content: center; 
            font-size: 46px; font-weight: 900; box-shadow: 0 10px 28px rgba(0,0,0,0.25), inset 0 2px 0 white; 
            margin-bottom: 4px; font-family: var(--font-display) !important;
            flex-shrink: 0;
        }

        /* Badge Coda Live Integrato sul Bottone: Design Moderno e Luminoso */
        .totem-btn-footer {
            display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 0 10px;
            flex-shrink: 0;
        }
        .totem-queue-pill {
            display: inline-flex; align-items: center; gap: 6px;
            background: rgba(255, 255, 255, 0.22); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
            padding: 6px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 800;
            letter-spacing: 0.3px; border: 1.5px solid rgba(255, 255, 255, 0.55);
            color: #ffffff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18), inset 0 1px 1px rgba(255, 255, 255, 0.4);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .totem-queue-pill .totem-queue-count-badge {
            background: #ffffff; color: #0f172a; font-weight: 900;
            padding: 2px 7px; border-radius: 10px; font-size: 12px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
            text-shadow: none; display: inline-block;
        }

        /* Animazione Invito al Tocco: Dito/Mano EXTRA-LARGE senza cerchio */
        .touch-invite-anim {
            display: inline-flex; align-items: center; justify-content: center;
            position: relative; padding-right: 4px;
        }
        .touch-finger-icon {
            width: 44px; height: 44px; color: #fef08a;
            filter: drop-shadow(0 4px 10px rgba(0,0,0,0.55));
            animation: touchFingerTap 1.6s infinite cubic-bezier(0.4, 0, 0.2, 1);
            transform-origin: bottom right;
        }

        @keyframes touchFingerTap {
            0%, 100% { transform: scale(1) translate(0, 0); }
            35% { transform: scale(1.22) translate(-4px, -6px); }
            45% { transform: scale(0.92) translate(2px, 3px); filter: drop-shadow(0 2px 4px rgba(0,0,0,0.7)); }
            60% { transform: scale(1) translate(0, 0); }
        }

        /* BOTTOM BAR TOTEM: BLU SCURO ELEGANTE CON WIDGET ORA, LINGUE E ACCESSIBILITA' */
        .totem-bottom-bar {
            width: auto; max-width: 96vw;
            display: inline-flex; align-items: center; justify-content: center; gap: 20px;
            background: rgba(14, 28, 54, 0.88); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
            padding: 10px 24px; border-radius: 36px;
            box-shadow: 0 20px 50px rgba(0,0,0,0.35), inset 0 1px 1px rgba(255,255,255,0.25);
            border: 1.5px solid rgba(255,255,255,0.25);
            margin: 0 auto;
            flex-shrink: 0;
        }

        /* Widget Orologio & Data Live */
        .totem-clock-widget {
            display: flex; flex-direction: column; align-items: center; justify-content: center;
            padding-right: 18px; border-right: 2px solid rgba(255,255,255,0.2);
            color: #ffffff; text-align: center; min-width: 90px;
        }
        .totem-clock-time {
            font-size: 20px; font-weight: 900; letter-spacing: 1px; color: #ffffff;
            font-family: var(--font-display) !important; line-height: 1.1;
        }
        .totem-clock-date {
            font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: capitalize;
            letter-spacing: 0.4px; margin-top: 2px;
        }

        /* Pulsante Accessibilità / Ipovedenti */
        .totem-accessible-btn {
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
            background: rgba(255, 255, 255, 0.12); border: 1.5px solid rgba(255, 255, 255, 0.35);
            padding: 8px 16px; border-radius: 22px; cursor: pointer; color: #ffffff;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            padding-left: 18px; border-left: 2px solid rgba(255,255,255,0.2);
        }
        .totem-accessible-btn:hover, .totem-accessible-btn:active {
            background: rgba(255, 255, 255, 0.25); transform: translateY(-2px);
        }
        .totem-accessible-btn i {
            font-size: 20px; color: #fef08a; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
        }
        .totem-accessible-btn span {
            font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.6px;
        }

        /* MODALITA' ACCESSIBILITA' ATTIVA: ALTO CONTRASTO FORTE & GRANDI DIMENSIONI */
        body.totem-accessible {
            background: #000000 !important;
        }
        body.totem-accessible .totem-card {
            background: #ffffff !important; border: 6px solid #fef08a !important;
            box-shadow: 0 0 40px rgba(254, 240, 138, 0.4) !important;
        }
        body.totem-accessible .totem-card h1 {
            font-size: clamp(2.4rem, 4vw, 3.8rem) !important; color: #000000 !important; font-weight: 950 !important;
        }
        body.totem-accessible .totem-card p {
            font-size: clamp(1.2rem, 1.8vw, 1.8rem) !important; color: #1e293b !important; font-weight: 800 !important;
        }
        body.totem-accessible .totem-btn {
            border: 4px solid #ffffff !important;
            box-shadow: 0 15px 35px rgba(0,0,0,0.6) !important;
        }
        body.totem-accessible .totem-grid.totem-count-1 .totem-btn,
        body.totem-accessible .totem-grid.totem-count-2 .totem-btn {
            min-height: 270px !important;
        }
        body.totem-accessible .totem-grid.totem-count-3 .totem-btn {
            min-height: 220px !important;
        }
        body.totem-accessible .totem-grid.totem-count-4 .totem-btn {
            min-height: 160px !important;
        }
        body.totem-accessible .totem-btn-title div {
            font-weight: 950 !important;
            color: #ffffff !important; text-shadow: 0 3px 6px rgba(0,0,0,0.9) !important;
        }
        body.totem-accessible .totem-queue-pill {
            font-size: 20px !important; padding: 12px 26px !important;
            background: #000000 !important; color: #fef08a !important; border: 2.5px solid #fef08a !important;
        }
        body.totem-accessible .totem-queue-count-badge {
            background: #fef08a !important; color: #000000 !important; font-size: 18px !important;
        }
        body.totem-accessible .totem-accessible-btn {
            background: #fef08a !important; color: #000000 !important; border-color: #ffffff !important;
            transform: scale(1.1); box-shadow: 0 0 20px rgba(254, 240, 138, 0.6) !important;
        }
        body.totem-accessible .totem-accessible-btn i {
            color: #000000 !important;
        }
        body.totem-accessible .totem-accessible-btn span {
            color: #000000 !important; font-weight: 950 !important;
        }

        .totem-lang-panel {
            display: inline-flex; align-items: center; justify-content: center; gap: 16px;
        }
        .totem-lang-label {
            font-size: 11px; font-weight: 900; color: #f8fafc; text-transform: uppercase;
            letter-spacing: 1px; display: flex; flex-direction: column; align-items: center; justify-content: center;
            gap: 4px; padding-right: 18px; border-right: 2px solid rgba(255,255,255,0.2);
            line-height: 1.15; text-align: center; white-space: nowrap;
        }
        .totem-lang-label i {
            font-size: 18px; margin-bottom: 2px;
        }
        .totem-lang-options {
            display: inline-flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: nowrap;
        }
        
        .totem-lang-btn {
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
            background: rgba(241, 245, 249, 0.9); border: 2.5px solid transparent;
            padding: 8px 20px; border-radius: 22px; cursor: pointer; min-width: 95px;
            opacity: 0.65; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 3px 10px rgba(0,0,0,0.06);
        }
        .totem-lang-btn .lang-flag {
            width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
            box-shadow: 0 4px 12px rgba(0,0,0,0.2); border: 2px solid white;
            transition: all 0.25s ease;
        }
        .totem-lang-btn .lang-text {
            font-size: 13px; font-weight: 900; color: #1e293b; text-transform: uppercase; letter-spacing: 0.5px;
        }
        .totem-lang-btn.active {
            opacity: 1; transform: scale(1.08) translateY(-2px); background: white;
            border-color: var(--primary-green); box-shadow: 0 10px 28px rgba(0,102,51,0.3);
        }
        .totem-lang-btn.active .lang-flag {
            border-color: var(--primary-green); transform: scale(1.05);
        }
        .totem-lang-btn.active .lang-text {
            color: var(--primary-green);
        }
        .totem-lang-btn:hover {
            opacity: 0.95; transform: translateY(-2px);
        }

        /* PULSANTE GUIDA SERVIZI INFO (NELLA BOTTOM BAR) */
        .totem-info-btn {
            display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
            background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(37, 99, 235, 0.35));
            border: 1.5px solid rgba(56, 189, 248, 0.6);
            padding: 8px 18px; border-radius: 22px; cursor: pointer; color: #ffffff;
            transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
            padding-left: 18px; border-left: 2px solid rgba(255,255,255,0.2);
            box-shadow: 0 4px 15px rgba(14, 165, 233, 0.25);
        }
        .totem-info-btn:hover, .totem-info-btn:active {
            background: linear-gradient(135deg, rgba(14, 165, 233, 0.45), rgba(37, 99, 235, 0.55));
            transform: translateY(-2px) scale(1.03);
            box-shadow: 0 8px 25px rgba(56, 189, 248, 0.45);
        }
        .totem-info-btn i {
            font-size: 20px; color: #38bdf8; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
        }
        .totem-info-btn span {
            font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.6px;
        }

        /* EVIDENZIAZIONE PULSANTE DURANTE LA GUIDA VOCALE */
        .totem-btn.guide-highlighted {
            transform: scale(1.04) translateY(-6px) !important;
            box-shadow: 0 0 0 5px #38bdf8, 0 0 40px rgba(56, 189, 248, 0.8), 0 25px 50px rgba(0,0,0,0.5) !important;
            animation: guidePulse 1.8s infinite alternate ease-in-out !important;
            z-index: 1500 !important;
        }
        @keyframes guidePulse {
            0% { box-shadow: 0 0 0 4px #38bdf8, 0 0 25px rgba(56, 189, 248, 0.6), 0 20px 40px rgba(0,0,0,0.4); }
            100% { box-shadow: 0 0 0 7px #7dd3fc, 0 0 50px rgba(125, 211, 252, 0.95), 0 30px 60px rgba(0,0,0,0.6); }
        }

        /* OVERLAY OSCURANTE LEGGERO DI GUIDA SENZA SFOCATURA SULLO SFONDO */
        .totem-guide-backdrop {
            position: fixed; inset: 0; background: rgba(10, 18, 35, 0.45);
            z-index: 1400; opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
        }
        .totem-guide-backdrop.active {
            opacity: 1; pointer-events: auto;
        }

        /* CALLOUT FLOTTANTE ESPLICATIVO CON FRECCIA DINAMICA (INGRANDITO) */
        .totem-guide-floating-box {
            position: fixed;
            z-index: 1600;
            width: 560px;
            max-width: 94vw;
            background: #ffffff;
            border: 3.5px solid #0284c7;
            border-radius: 32px;
            padding: 28px 30px 24px 30px;
            box-shadow: 0 35px 80px rgba(0, 0, 0, 0.5), 0 0 45px rgba(14, 165, 233, 0.35);
            display: none;
            flex-direction: column;
            gap: 16px;
            text-align: left;
            transition: top 0.45s cubic-bezier(0.25, 1, 0.5, 1), left 0.45s cubic-bezier(0.25, 1, 0.5, 1), transform 0.45s ease;
            box-sizing: border-box;
            animation: fadeInGuide 0.3s ease-out;
        }
        @keyframes fadeInGuide {
            from { opacity: 0; transform: scale(0.92); }
            to { opacity: 1; transform: scale(1); }
        }
        /* Puntatore / Freccia del Box */
        .totem-guide-arrow {
            position: absolute;
            width: 22px;
            height: 22px;
            background: #ffffff;
            border: 3px solid #0284c7;
            transform: rotate(45deg);
            z-index: -1;
        }
        .totem-guide-floating-box.arrow-bottom .totem-guide-arrow {
            bottom: -12px; left: 50%; margin-left: -11px;
            border-top: none; border-left: none;
        }
        .totem-guide-floating-box.arrow-top .totem-guide-arrow {
            top: -12px; left: 50%; margin-left: -11px;
            border-bottom: none; border-right: none;
        }
        .totem-guide-floating-box.arrow-left .totem-guide-arrow {
            left: -12px; top: 50%; margin-top: -11px;
            border-top: none; border-right: none;
        }
        .totem-guide-floating-box.arrow-right .totem-guide-arrow {
            right: -12px; top: 50%; margin-top: -11px;
            border-bottom: none; border-left: none;
        }

        /* MODALE RITIRO BIGLIETTO CON COUNTDOWN BAR */
        .collect-modal { display: none; position: fixed; top:0; left:0; width:100%; height:100%; background: rgba(15, 23, 42, 0.93); z-index: 3000; justify-content: center; align-items: center; backdrop-filter: blur(25px); padding: 2.5vh 2vw; box-sizing: border-box; }
        .collect-box { 
            background: white; width: 96%; max-width: 1380px; padding: 26px 44px 20px 44px; border-radius: 46px; 
            box-shadow: 0 35px 120px rgba(0,0,0,0.55); text-align: center; 
            border: 6.5px solid var(--primary-green); display: flex; flex-direction: column; align-items: center; 
            animation: zoomInModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            position: relative; overflow: hidden; max-height: 95vh; box-sizing: border-box;
        }

        /* Countdown Progress Bar */
        .modal-countdown-bar-wrap {
            position: absolute; bottom: 0; left: 0; width: 100%; height: 9px; background: #e2e8f0;
        }
        .modal-countdown-bar {
            height: 100%; width: 100%; background: linear-gradient(90deg, #10b981, #006633);
            transition: width 4s linear;
        }
        @keyframes zoomInModal {
            0% { transform: scale(0.85); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }

        .collect-content { 
            display: flex; justify-content: space-around; align-items: center; gap: 48px; width: 100%; 
            margin: auto 0;
        }

        /* Video Animazione Stampante Termica MP4 - Sollevato e perfettamente bilanciato */
        .printer-video-wrap {
            position: relative; width: 590px; height: 350px; max-width: 48vw;
            display: flex; align-items: center; justify-content: center;
            background: transparent; border: none; box-shadow: none;
            margin: -20px 0 2px 0;
            -webkit-mask-image: radial-gradient(ellipse 92% 92% at 50% 50%, black 78%, transparent 100%);
            mask-image: radial-gradient(ellipse 92% 92% at 50% 50%, black 78%, transparent 100%);
        }
        .printer-video-el {
            width: 100%; height: 100%; object-fit: contain;
            background: transparent;
            mix-blend-mode: multiply;
            filter: brightness(1.06) contrast(1.18);
        }

        .collect-left { 
            display: flex; flex-direction: column; align-items: center; justify-content: center; 
            flex: 1.2; text-align: center; margin-top: -15px;
        }
        .collect-text { 
            font-size: 44px; font-weight: 900; line-height: 1.12; text-align: center; color: #0f172a; 
            text-transform: uppercase; letter-spacing: -0.5px; margin-top: 8px; 
        }
        .collect-arrow { 
            font-size: 95px; color: var(--primary-green); line-height: 1; display: flex; align-items: center; justify-content: center;
            animation: bounce-left 1.1s infinite; margin-top: 6px; filter: drop-shadow(0 10px 22px rgba(0,102,51,0.4)); 
        }
        
        /* Slot e Animazione Biglietto Stampato */
        .collect-printer-slot {
            position: relative; padding: 14px; background: #e2e8f0; border-radius: 30px;
            box-shadow: inset 0 4px 12px rgba(0,0,0,0.18), 0 20px 45px rgba(0,0,0,0.14);
            flex-shrink: 0; display: flex; align-items: center; justify-content: center;
        }
        .collect-preview-container { 
            background: white; border-radius: 22px; box-shadow: 0 16px 45px rgba(0,0,0,0.18); 
            animation: ticketDispense 1.2s cubic-bezier(0.25, 1, 0.5, 1);
            position: relative; overflow: hidden;
        }
        @keyframes ticketDispense {
            0% { transform: translateY(-70px) scale(0.9); opacity: 0; }
            50% { transform: translateY(10px) scale(1.02); opacity: 1; }
            100% { transform: translateY(0) scale(1); opacity: 1; }
        }
        .collect-sub { 
            font-size: 22px; color: #64748b; text-transform: uppercase; font-weight: 900; 
            border-top: 2px solid #f1f5f9; padding-top: 12px; margin-top: 12px; width: 100%; letter-spacing: 0.5px; 
        }
        @keyframes bounce-left { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-35px); } }
        @keyframes bounce-right { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(35px); } }
        
        .logout-btn { position: absolute; top: 30px; right: 30px; background: #e53935; color: white; padding: 10px 20px; text-decoration: none; border-radius: 10px; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.1); font-size: 14px; text-transform: uppercase; }
        .logout-btn:hover { background: #b71c1c; }

        /* ========================================================= */
        /* STILI DARK MODE STAFF (Punto 5)                           */
        /* ========================================================= */
        body.dark-staff {
            background: #0f172a !important;
            color: #e2e8f0 !important;
        }
        body.dark-staff header,
        body.dark-staff .bg-white {
            background-color: #1e293b !important;
            border-color: #334155 !important;
            color: #f1f5f9 !important;
        }
        body.dark-staff .text-slate-900,
        body.dark-staff .text-slate-800 {
            color: #f8fafc !important;
        }
        body.dark-staff .text-slate-700,
        body.dark-staff .text-slate-600,
        body.dark-staff .text-slate-500 {
            color: #cbd5e1 !important;
        }
        body.dark-staff .text-slate-400 {
            color: #94a3b8 !important;
        }
        body.dark-staff .bg-slate-50,
        body.dark-staff .bg-slate-50\/70,
        body.dark-staff .bg-slate-50\/80 {
            background-color: #0f172a !important;
            border-color: #334155 !important;
        }
        body.dark-staff .bg-slate-100 {
            background-color: #1e293b !important;
            border-color: #475569 !important;
        }
        body.dark-staff .border-slate-100,
        body.dark-staff .border-slate-200,
        body.dark-staff .border-slate-200\/80,
        body.dark-staff .border-slate-200\/90 {
            border-color: #334155 !important;
        }
        body.dark-staff .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
            border-color: #334155 !important;
        }
        body.dark-staff input[type="text"] {
            background-color: #0f172a !important;
            border-color: #475569 !important;
            color: #f8fafc !important;
        }
        body.dark-staff .desk-modal-card {
            background-color: #0f172a !important;
            border-color: #334155 !important;
        }
        body.dark-staff .desk-modal-card:hover {
            border-color: #059669 !important;
            background-color: #1e293b !important;
        }

        /* Toast feedback animazione (Punto 4) */
        #staffToast {
            transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            transform: translateY(100px) scale(0.9);
            opacity: 0;
            pointer-events: none;
        }
        #staffToast.show {
            transform: translateY(0) scale(1);
            opacity: 1;
            pointer-events: auto;
        }

        /* Flash pulsazione chiamata su card corrente (Punto 4) */
        @keyframes staffCallFlash {
            0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
            50% { transform: scale(1.03); box-shadow: 0 0 35px 10px rgba(16, 185, 129, 0.4); }
            100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
        }
        .call-flash-effect {
            animation: staffCallFlash 0.7s ease-out;
        }

        /* ========================================================= */
        /* ANIMAZIONE RISALTO PROSSIMO BIGLIETTO IN CODA (#1)       */
        /* ========================================================= */
        @keyframes nextTicketPulse {
            0%, 100% {
                border-color: rgba(16, 185, 129, 0.6);
                box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4), 0 4px 12px rgba(16, 185, 129, 0.1);
                transform: translateY(0);
            }
            50% {
                border-color: rgba(16, 185, 129, 1);
                box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.15), 0 10px 25px rgba(16, 185, 129, 0.25);
                transform: translateY(-2px);
            }
        }
        .next-ticket-active {
            animation: nextTicketPulse 2.4s infinite ease-in-out;
            background: linear-gradient(to right, #f0fdf4, #ffffff) !important;
            border-width: 2px !important;
        }
        body.dark-staff .next-ticket-active {
            background: linear-gradient(to right, #064e3b22, #1e293b) !important;
            border-color: #10b981 !important;
        }

        @keyframes badgeGlowPulse {
            0%, 100% { transform: scale(1); filter: brightness(1); }
            50% { transform: scale(1.04); filter: brightness(1.15); box-shadow: 0 6px 18px rgba(0,0,0,0.25); }
        }
        .next-badge-pulse {
            animation: badgeGlowPulse 2.4s infinite ease-in-out;
        }
