        :root {
            /* Rotondità globale: un solo parametro in % da auth.ini ([settings]
               border_radius). 100% = look di default, 0% = squadrato, 150% = più
               tondo. Le basi px tengono le proporzioni superfici/controlli. */
            --radius-scale: 1;
            --radius: calc(16px * var(--radius-scale));
            --radius-sm: calc(8px * var(--radius-scale));
            --bg-from: #1e3c72;
            --bg-to: #2a5298;
            --text: #ffffff;
            --text-dim: rgba(255,255,255,0.55);
            --glass: rgba(255,255,255,0.1);
            --glass-border: rgba(255,255,255,0.15);
            --card: rgba(255,255,255,0.07);
            --card-border: rgba(255,255,255,0.11);
            --card-hover: rgba(255,255,255,0.14);
            --card-hover-border: rgba(255,255,255,0.25);
            --input-text: #ffffff;
            --placeholder: rgba(255,255,255,0.5);
            --btn: rgba(255,255,255,0.15);
            --btn-hover: rgba(255,255,255,0.25);
            --track: rgba(255,255,255,0.2);
            --track-thumb: #ffffff;
            --key-bg: rgba(255,255,255,0.12);
            --dot-idle: rgba(255,255,255,0.2);
            --icon-bg: transparent;
            --ticker-link: rgba(255,255,255,0.82);
            --divider: rgba(255,255,255,0.12);
            /* Tab (linguette) uniformi: sfondo della tab attiva/hover. Tema chiaro
               (base blu) → overlay SCURO; tema scuro → overlay CHIARO (vedi body.dark). */
            --tab-active-bg: rgba(0,0,0,0.20);
            --tab-hover-bg: rgba(0,0,0,0.10);
        }
        body.dark {
            --bg-from: #0f1117;
            --bg-to: #1a1d27;
            --text: #e2e8f0;
            --text-dim: rgba(226,232,240,0.45);
            --glass: rgba(255,255,255,0.04);
            --glass-border: rgba(255,255,255,0.07);
            --card: rgba(255,255,255,0.04);
            --card-border: rgba(255,255,255,0.07);
            --card-hover: rgba(255,255,255,0.09);
            --card-hover-border: rgba(255,255,255,0.14);
            --input-text: #e2e8f0;
            --placeholder: rgba(226,232,240,0.35);
            --btn: rgba(255,255,255,0.07);
            --btn-hover: rgba(255,255,255,0.12);
            --track: rgba(255,255,255,0.12);
            --track-thumb: #e2e8f0;
            --key-bg: rgba(255,255,255,0.07);
            --dot-idle: rgba(255,255,255,0.15);
            --icon-bg: transparent;
            --ticker-link: rgba(226,232,240,0.7);
            --divider: rgba(255,255,255,0.07);
            --tab-active-bg: rgba(255,255,255,0.10);
            --tab-hover-bg: rgba(255,255,255,0.05);
        }

        * { margin: 0; padding: 0; box-sizing: border-box; }
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
            background-attachment: fixed;
            min-height: 100vh;
            display: flex;
            align-items: flex-start;
            justify-content: center;
            padding: 5rem 0 4rem;
            color: var(--text);
            transition: background .4s, color .4s;
        }
        .container {
            position: relative;
            text-align: center;
            padding: 3rem;
            background: var(--glass);
            backdrop-filter: blur(10px);
            border-radius: var(--radius);
            border: 1px solid var(--glass-border);
            box-shadow: 0 8px 32px rgba(0,0,0,0.2);
            width: min(760px, calc(100% - 2rem));
            transition: background .4s, border-color .4s;
        }
        .logo {
            max-width: 180px;
            margin-bottom: 1.2rem;
            filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
        }

        /* Greeting */
        .greeting {
            font-size: 0.85rem;
            color: var(--text-dim);
            text-transform: uppercase;
            letter-spacing: 0.12em;
            margin-bottom: 0.5rem;
        }

        /* Weather */
        .weather-wrapper { margin-bottom: 1.2rem; }
        .weather-btn {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.3rem 1rem;
            color: var(--text);
            cursor: pointer;
            font-size: 0.78rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            opacity: 0.7;
            transition: opacity .15s, background .15s;
        }
        .weather-btn:hover { opacity: 1; background: var(--btn-hover); }
        .weather {
            font-size: 0.88rem;
            color: var(--text);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }
        .weather-temp { font-weight: 600; color: var(--text); }
        .weather-city { color: var(--text); }

        /* Clock */
        .clock { margin-bottom: 2rem; }
        .clock-time {
            font-size: 3rem;
            font-weight: 200;
            letter-spacing: 0.04em;
            line-height: 1;
        }
        .clock-date {
            font-size: 0.8rem;
            color: var(--text-dim);
            margin-top: 0.35rem;
            text-transform: uppercase;
            letter-spacing: 0.1em;
        }

        /* Service cards */
        /* #servicesGrid è ora un contenitore di .folder-block annidati; la griglia
           a 4 colonne vive in ogni .folder-grid. */
        .services {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .folder-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.75rem;
        }
        /* il collasso di una sezione nasconde tutto il suo contenuto */
        .folder-block.collapsed > .folder-content { display: none; }

        /* Sottocartella come CARD (vista card → drill-down) */
        .folder-entry {
            position: relative; display: flex; flex-direction: column;
            align-items: center; justify-content: center; gap: 0.45rem;
            padding: 1.2rem 0.8rem 1rem;
            background: var(--card); border: 1px solid var(--card-border);
            border-radius: var(--radius); color: var(--text); cursor: pointer;
            transition: background .15s, transform .15s, border-color .15s;
        }
        .folder-entry:hover { transform: translateY(-2px); border-color: var(--card-hover-border); }
        .folder-entry .service-name { font-size: 0.85rem; font-weight: 600; }

        /* Sottocartella come RIGA (vista elenco → file manager ad albero) */
        .folder-entry.list {
            grid-column: 1 / -1; flex-direction: row; justify-content: flex-start;
            align-items: center; gap: 0.5rem; padding: 0.25rem 0.6rem; margin-top: -0.75rem;
            background: none; border: none; border-bottom: 1px solid var(--glass-border);
            border-radius: 0; transform: none; text-align: left;
        }
        .folder-entry.list:hover { transform: none; background: var(--glass); }
        .folder-entry.list .fe-chev { width: 1rem; text-align: center; opacity: 0.7; transition: transform .15s; }
        .folder-entry.list .fe-chev.open { transform: rotate(90deg); }
        .folder-entry.list .fe-icon { line-height: 0; display: inline-flex; }
        .folder-entry.list .fe-icon img { width: 0.95rem; height: 0.95rem; }
        .folder-entry.list .fe-name { flex: 1; font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .folder-entry.list .fe-count { font-size: 0.72rem; color: var(--text-dim); }

        /* Breadcrumb di navigazione (vista card) */
        .folder-crumbs { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; padding: 0.1rem 0.2rem 0.6rem; font-size: 0.8rem; color: var(--text-dim); }
        .folder-crumbs .crumb-back { cursor: pointer; color: var(--text); margin-right: 0.4rem; }
        .folder-crumbs .crumb.link { cursor: pointer; color: var(--text); }
        .folder-crumbs .crumb-back:hover, .folder-crumbs .crumb.link:hover { text-decoration: underline; }
        .folder-crumbs .crumb-sep { opacity: 0.5; }
        .service-card {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.45rem;
            padding: 1.2rem 0.8rem 1rem;
            background: var(--card);
            border: 1px solid var(--card-border);
            border-radius: var(--radius);
            color: var(--text);
            text-decoration: none;
            transition: background .15s, transform .15s, border-color .15s;
        }
        .service-card:hover {
            background: var(--card-hover);
            border-color: var(--card-hover-border);
            transform: translateY(-3px);
        }
        .service-icon { font-size: 1.9rem; line-height: 1; }
        .service-icon svg { width: 1.9rem; height: 1.9rem; fill: var(--text); }
        .service-icon img {
            width: 1.9rem; height: 1.9rem;
            object-fit: contain;
            background: var(--icon-bg);
            border-radius: var(--radius-sm);
            padding: 2px;
        }
        .service-name { font-size: 0.85rem; font-weight: 600; }
        .service-sub  { font-size: 0.62rem; opacity: 0.45; text-transform: uppercase; letter-spacing: 0.06em; }
        .group-separator {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
            align-items: center;
            gap: 0.75rem;
            opacity: 0.4;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            cursor: pointer;
            user-select: none;
            transition: opacity .15s;
        }
        .group-separator:hover { opacity: 0.7; }
        /* linea di sinistra (col 1) */
        .group-separator::before {
            content: '';
            height: 1px;
            background: var(--glass-border);
        }
        /* col 2: testo centrato; col 3: linea + strumenti allineati a destra */
        .sep-center { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
        .sep-right { display: flex; align-items: center; gap: 0.6rem; }
        .sep-line { flex: 1; height: 1px; background: var(--glass-border); }
        .group-label { white-space: nowrap; }
        .group-chevron {
            font-size: 1.1rem;
            line-height: 1;
            transition: transform .15s;
        }
        .folder-block.collapsed > .group-separator .group-chevron { transform: rotate(-90deg); }
        /* a gruppo collassato nascondi gli strumenti (toggle vista + ricerca) */
        .folder-block.collapsed > .group-separator .group-mode,
        .folder-block.collapsed > .group-separator .gm-divider,
        .folder-block.collapsed > .group-separator .gm-lens { display: none; }
        /* Toggle vista card/elenco (gruppi multimode) */
        .group-mode { display: inline-flex; flex-shrink: 0; }
        .gm-btn {
            display: flex; align-items: center; justify-content: center;
            width: 24px; height: 19px; padding: 0;
            background: none; border: 1px solid var(--glass-border); color: var(--text);
            cursor: pointer; opacity: 0.45;
            transition: opacity .15s, background .15s;
        }
        .gm-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
        .gm-btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }
        .gm-btn.active { opacity: 1; background: var(--btn); }
        .gm-btn svg { width: 12px; height: 12px; }
        .gm-divider { width: 1px; height: 16px; background: var(--glass-border); flex-shrink: 0; }
        .gm-lens {
            display: flex; align-items: center; justify-content: center;
            width: 24px; height: 19px; padding: 0;
            background: none; border: 1px solid var(--glass-border); color: var(--text);
            border-radius: var(--radius-sm);
            cursor: pointer; opacity: 0.45;
            transition: opacity .15s, background .15s;
        }
        .gm-lens:hover { opacity: 0.85; }
        .gm-lens.active { opacity: 1; background: var(--btn); }
        .gm-lens.filtering { opacity: 1; background: #22c55e; border-color: #22c55e; color: #000; }
        .gm-lens svg { width: 12px; height: 12px; }

        /* Vista elenco compatta (stile esplora file): icona · Nome · File · Scadenza.
           Righe piatte con separatore sottile; la riga stessa è il link/download. */
        .service-card.list-item {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1.5rem 1fr 1fr 6.5rem 1.3rem;
            align-items: center;
            gap: 0.8rem;
            padding: 0.15rem 0.6rem;
            margin-top: -0.75rem;   /* annulla il gap verticale della griglia .services */
            text-align: left;
            transform: none;
            background: none;
            border: none;
            border-bottom: 1px solid var(--glass-border);
            border-radius: 0;
            box-shadow: none;
            min-height: 0;
        }
        .service-card.list-item:hover { transform: none; background: var(--glass); }
        .service-card.list-item:last-child { border-bottom: none; }
        .service-card.list-item .card-key,
        .service-card.list-item .status-dot,
        .service-card.list-item .download-badge,
        .service-card.list-item .expiry-badge { display: none; }
        .service-card.list-item .service-icon {
            justify-self: center;
            display: flex; align-items: center; justify-content: center;
            font-size: 0; line-height: 0;   /* niente line-box da 1.9rem che gonfia la riga */
        }
        .service-card.list-item .service-icon img { display: block; width: 1rem; height: 1rem; }
        .service-card.list-item .service-name { font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .list-file, .list-expiry, .list-dl { display: none; }
        .service-card.list-item .list-file {
            display: block;
            font-size: 0.76rem;
            color: var(--text-dim);
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        .service-card.list-item .list-expiry {
            display: block;
            font-size: 0.76rem;
            color: var(--text-dim);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }
        .service-card.list-item .list-expiry.warn { color: #f59e0b; }
        .service-card.list-item .list-expiry.expired { color: #ef4444; font-weight: 600; }
        .service-card.list-item .list-dl { display: flex; align-items: center; justify-content: center; opacity: 0.45; line-height: 0; }
        .service-card.list-item:hover .list-dl { opacity: 0.85; }
        .service-card.list-item .list-dl svg { display: block; width: 15px; height: 15px; fill: #22c55e; }

        /* Popup di ricerca documenti, ancorato sotto la lente */
        .search-popup {
            position: fixed;
            z-index: 99999;
            background: var(--bg-to);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.45rem;
            box-shadow: 0 12px 32px rgba(0,0,0,0.5);
            animation: popIn .12s ease;
        }
        /* caretto che punta alla lente */
        .search-popup::before {
            content: '';
            position: absolute;
            top: -5px;
            left: var(--caret, 50%);
            transform: translateX(-50%) rotate(45deg);
            width: 9px; height: 9px;
            background: var(--bg-to);
            border-left: 1px solid var(--glass-border);
            border-top: 1px solid var(--glass-border);
        }
        @keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
        .list-search {
            width: 220px;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.35rem 0.6rem;
            color: var(--input-text);
            font: inherit;
            font-size: 0.8rem;
            text-transform: none;
            letter-spacing: normal;
            outline: none;
        }
        .list-search:focus { border-color: var(--card-hover-border); }
        .list-search::placeholder { color: var(--placeholder); }
        /* X di cancellazione (Chrome): resa bianca via mask SVG */
        .list-search::-webkit-search-cancel-button {
            -webkit-appearance: none;
            appearance: none;
            width: 11px; height: 11px;
            cursor: pointer;
            background-color: var(--text);
            -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6 18 18 M18 6 6 18' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6 18 18 M18 6 6 18' stroke='%23000' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
        }

        /* Intestazione colonne (ordinabile) */
        .list-header {
            grid-column: 1 / -1;
            grid-template-columns: 1.5rem 1fr 1fr 6.5rem 1.3rem;
            gap: 0.8rem;
            padding: 0.1rem 0.6rem 0.3rem;
            font-size: 0.62rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-dim);
            text-align: left;
        }
        .list-header .lh-sort { cursor: pointer; user-select: none; white-space: nowrap; }
        .list-header .lh-sort:hover { color: var(--text); }
        .list-header .lh-sort.sort-asc::after  { content: ' ▲'; font-size: 0.8em; }
        .list-header .lh-sort.sort-desc::after { content: ' ▼'; font-size: 0.8em; }
        .card-key {
            position: absolute;
            top: 0.45rem; left: 0.55rem;
            font-size: 0.6rem;
            font-weight: 700;
            opacity: 0.35;
            background: var(--key-bg);
            border-radius: 4px;
            padding: 0.1rem 0.32rem;
            letter-spacing: 0.03em;
        }

        /* Vista "Utenti collegati" */
        .user-row {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.55rem 0.9rem;
            border-bottom: 1px solid var(--divider);
            font-size: 0.85rem;
        }
        .user-row:last-child { border-bottom: none; }
        .user-dot {
            width: 8px; height: 8px;
            border-radius: 50%;
            background: #22c55e;
            flex-shrink: 0;
        }
        .user-name { font-weight: 600; }
        .user-ago { margin-left: auto; color: var(--text-dim); font-size: 0.75rem; }
        .user-kick {
            background: none;
            border: 1px solid var(--glass-border);
            color: var(--text-dim);
            font: inherit;
            font-size: 0.7rem;
            padding: 0.15rem 0.55rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            flex-shrink: 0;
            transition: color .15s, border-color .15s, background .15s;
        }
        .user-kick:hover { color: #fff; border-color: rgba(239,68,68,0.6); background: rgba(239,68,68,0.25); }
        .users-empty { color: var(--text-dim); font-size: 0.85rem; padding: 0.5rem 0.9rem; }

        /* Registro attività (audit) */
        .audit-section {
            font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
            letter-spacing: 0.08em; color: var(--text-dim);
            margin: 0.7rem 0 0.3rem;
            padding: 0 0.9rem;
        }
        .audit-section:first-child { margin-top: 0; }
        .audit-row {
            display: flex; align-items: center; gap: 0.55rem;
            padding: 0.4rem 0.9rem;
            border-bottom: 1px solid var(--divider);
            font-size: 0.8rem;
        }
        .audit-row:last-child { border-bottom: none; }
        .audit-time { color: var(--text-dim); font-size: 0.7rem; font-variant-numeric: tabular-nums; flex-shrink: 0; }
        .audit-type { font-weight: 600; }
        .audit-type.login_failed, .audit-type.totp_failed { color: #f59e0b; }
        .audit-type.kick { color: #ef4444; }
        .audit-user { font-weight: 600; }
        .audit-detail { color: var(--text-dim); font-size: 0.75rem; }
        .audit-ip { margin-left: auto; color: var(--text-dim); font-size: 0.7rem; font-variant-numeric: tabular-nums; }
        .audit-badge.locked {
            background: rgba(239,68,68,0.25);
            border: 1px solid rgba(239,68,68,0.6);
            color: #fff; border-radius: var(--radius-sm);
            padding: 0.05rem 0.4rem; font-size: 0.62rem; font-weight: 700;
        }

        /* Badge di notifica admin (pallino rosso) su menu ☰ e voce Registro */
        .view-menu-btn.has-alert, .view-menu-item.has-alert { position: relative; }
        .view-menu-btn.has-alert::after, .view-menu-item.has-alert::after {
            content: '';
            position: absolute;
            top: 4px; right: 4px;
            width: 7px; height: 7px;
            border-radius: 50%;
            background: #ef4444;
            box-shadow: 0 0 0 2px var(--bg-to);
        }
        /* su una voce admin il pallino alert va a sinistra del badge ADMIN */
        .view-menu-item.admin-only.has-alert::after { top: 50%; right: 3.4rem; transform: translateY(-50%); }

        /* Pulsante Wake-on-LAN sugli host scomparsi */
        .wol-btn {
            margin-left: auto;
            background: none;
            border: 1px solid var(--glass-border);
            color: var(--text-dim);
            font: inherit;
            font-size: 0.68rem;
            padding: 0.1rem 0.5rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            flex-shrink: 0;
            transition: color .15s, border-color .15s, background .15s;
        }
        .wol-btn:hover { color: #fff; border-color: rgba(34,197,94,0.6); background: rgba(34,197,94,0.25); }
        .wol-btn:disabled { opacity: 0.6; cursor: default; }
        .audit-unblock {
            margin-left: 0.55rem;
            background: none;
            border: 1px solid var(--glass-border);
            color: var(--text-dim);
            font: inherit;
            font-size: 0.68rem;
            padding: 0.1rem 0.5rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            flex-shrink: 0;
            transition: color .15s, border-color .15s, background .15s;
        }
        .audit-unblock:hover { color: #fff; border-color: rgba(34,197,94,0.6); background: rgba(34,197,94,0.25); }

        /* Menu contestuale (tasto destro sulle card) */
        .ctx-menu {
            position: fixed;
            z-index: 99999;
            min-width: 190px;
            display: flex;
            flex-direction: column;
            padding: 0.3rem;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            box-shadow: 0 12px 32px rgba(0,0,0,0.5);
            backdrop-filter: blur(14px);
        }
        .ctx-item {
            background: none;
            border: none;
            color: var(--text);
            font: inherit;
            font-size: 0.82rem;
            text-align: left;
            padding: 0.5rem 0.7rem;
            border-radius: 6px;
            cursor: pointer;
            white-space: nowrap;
        }
        .ctx-item:hover { background: var(--btn-hover); }

        /* Status dot */
        .status-dot {
            position: absolute;
            top: 0.6rem; right: 0.6rem;
            width: 8px; height: 8px;
            border-radius: 50%;
            background: var(--dot-idle);
            transition: background .4s;
        }
        .status-dot.up   { background: #22c55e; }
        .status-dot.down { background: #ef4444; }
        /* Card con servizio offline: non cliccabile e attenuata */
        .service-card.offline {
            pointer-events: none;
            opacity: 0.45;
            filter: grayscale(0.4);
        }

        /* Finestre flottanti embedded dentro la dashboard */
        .embed-layer {
            position: fixed;
            inset: 0;
            z-index: 1000;
            pointer-events: none;   /* la dashboard sotto resta usabile */
        }
        .embed-window {
            pointer-events: auto;
            position: absolute;
            width: 80vw;
            height: 80vh;
            background: #0b1020;
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            box-shadow: 0 20px 60px rgba(0,0,0,0.55);
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: opacity .25s ease, transform .25s ease, border-color .15s ease, box-shadow .15s ease;
        }
        /* Finestra in primo piano: niente bordo colorato, solo la barra del
           titolo più chiara come indicatore di focus. */
        .embed-window:not(.focused) .embed-bar { background: #18222f; }
        .embed-window.focused .embed-bar { background: #243a52; }
        /* Animazione applicata solo durante snap/massimizza, non nel drag */
        .embed-window.animating {
            transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease;
        }
        .embed-window.maximized {
            left: 0 !important;
            top: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
            border-radius: 0;
        }
        /* Minimizzata: l'animazione "vola nella dock" è guidata via JS (transform
           inline verso la chip). Qui basta disattivare l'interazione. */
        .embed-window.docked { pointer-events: none; }

        /* Dock delle finestre ridotte (basso-sinistra, stile taskbar) */
        .embed-dock {
            position: fixed;
            left: 0.6rem;
            /* sopra la barra news (.ticker-bar è alta 2.4rem in basso) */
            bottom: calc(2.4rem + 0.6rem);
            z-index: 1200;
            display: flex;
            gap: 0.4rem;
            pointer-events: none;
        }
        .embed-chip {
            pointer-events: auto;
            max-width: 180px;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            /* sfondo solido: la chip resta leggibile anche sopra finestre chiare */
            background: #1e293b;
            border: 1px solid var(--glass-border);
            color: #e2e8f0;
            border-radius: var(--radius-sm);
            padding: 0.4rem 0.7rem;
            font-size: 0.72rem;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            box-shadow: 0 6px 18px rgba(0,0,0,0.4);
            transition: background .15s;
        }
        .embed-chip:hover { background: #29384d; }

        /* Anteprima della zona di snap durante il trascinamento */
        .snap-preview {
            position: fixed;
            z-index: 1095;
            display: none;
            background: rgba(99,179,237,0.22);
            border: 2px solid rgba(99,179,237,0.7);
            border-radius: var(--radius-sm);
            pointer-events: none;
            transition: left .12s ease, top .12s ease, width .12s ease, height .12s ease;
        }
        .snap-preview.show { display: block; }
        .embed-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.45rem 0.5rem 0.45rem 0.9rem;
            background: #1e293b;
            border-bottom: 1px solid var(--glass-border);
            cursor: move;
            user-select: none;
        }
        .embed-window.maximized .embed-bar { cursor: default; }
        .embed-left {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            min-width: 0;          /* consente l'ellissi del titolo nel flex */
        }
        .embed-title {
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .embed-actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
        .embed-btn {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            color: var(--text);
            border-radius: 6px;
            width: 28px; height: 28px;
            font-size: 0.85rem;
            line-height: 1;
            cursor: pointer;
            font-family: inherit;
            transition: background .15s;
        }
        .embed-btn:hover { background: var(--btn-hover); }
        .embed-close:hover { background: rgba(239,68,68,0.6); }
        .embed-body {
            position: relative;
            flex: 1;
            min-height: 0;
            display: flex;
        }
        .embed-frame {
            flex: 1;
            width: 100%;
            border: 0;
            background: #fff;
        }
        /* Overlay "click per mettere a fuoco": attivo solo sulle finestre NON in
           primo piano. Il click finisce qui (documento padre) e fa scattare il
           bringFront già agganciato a .embed-window; appena la finestra è a fuoco
           sparisce e i click tornano all'iframe. */
        .embed-focuscatch {
            position: absolute;
            inset: 0;
            z-index: 3;
            display: none;
        }
        .embed-window:not(.focused) .embed-focuscatch { display: block; }
        /* Maniglie di ridimensionamento ai 4 angoli (invisibili). I pulsanti
           della barra stanno sopra (z-index più alto) così non vanno in
           conflitto con l'angolo in alto a destra. */
        .embed-grip {
            position: absolute;
            width: 18px; height: 18px;
            z-index: 6;
        }
        .embed-grip.nw { top: 0;    left: 0;  cursor: nwse-resize; }
        .embed-grip.ne { top: 0;    right: 0; cursor: nesw-resize; }
        .embed-grip.sw { bottom: 0; left: 0;  cursor: nesw-resize; }
        .embed-grip.se { bottom: 0; right: 0; cursor: nwse-resize; }
        .embed-btn { position: relative; z-index: 7; }
        .embed-window.maximized .embed-grip { display: none; }
        /* Pannello mostrato se l'iframe non può caricare (cert/framing/host) */
        .embed-fallback {
            position: absolute;
            inset: 0;
            z-index: 10;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1.1rem;
            padding: 2rem;
            text-align: center;
            background: #0b1020;
            color: var(--text);
        }
        .embed-fallback p { max-width: 380px; font-size: 0.9rem; line-height: 1.5; opacity: 0.85; }
        .embed-fallback-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }
        .embed-fallback-btn {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            color: var(--text);
            font: inherit;
            font-size: 0.85rem;
            padding: 0.5rem 0.9rem;
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: background .15s;
        }
        .embed-fallback-btn:hover { background: var(--btn-hover); }
        .embed-fallback-btn.ghost { background: none; }
        .embed-fallback-btn.ghost:hover { background: var(--btn); }
        /* Scudo trasparente attivo durante il drag, così l'iframe non "mangia" il mouse */
        .embed-shield {
            position: fixed;
            inset: 0;
            z-index: 1100;
            display: none;
            pointer-events: auto;
            cursor: move;
        }
        .embed-shield.active { display: block; }
        .download-badge {
            position: absolute;
            bottom: 0.45rem; right: 0.55rem;
            opacity: 0.4;
            line-height: 0;
        }
        .download-badge svg {
            width: 22px; height: 22px;
            fill: #22c55e;
        }
        .expiry-badge {
            position: absolute;
            bottom: 0.45rem; left: 0.55rem;
            font-size: 0.55rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            border-radius: 4px;
            padding: 0.05rem 0.3rem;
        }
        .expiry-badge.warn {
            color: #f59e0b;
            background: rgba(245,158,11,0.12);
            border: 1px solid rgba(245,158,11,0.3);
        }
        .expiry-badge.expired {
            color: #ef4444;
            background: rgba(239,68,68,0.12);
            border: 1px solid rgba(239,68,68,0.3);
        }

        /* Theme toggle */
        .theme-toggle {
            position: fixed;
            bottom: 3.2rem;
            right: 1rem;
            display: flex;
            align-items: center;
            gap: 0.45rem;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.35rem 0.7rem;
            color: var(--text);
            cursor: pointer;
            font-size: 0.72rem;
            font-weight: 600;
            letter-spacing: 0.04em;
            backdrop-filter: blur(16px);
            z-index: 101;
            transition: background .15s, border-color .15s;
        }
        .theme-toggle:hover { background: var(--btn-hover); }
        /* In modalità custom (niente barra ANSA in basso) il toggle sale in alto
           a destra, allineato ai pulsanti della topbar. In classica resta in basso. */
        body.custom-layout .theme-toggle { top: 1rem; bottom: auto; right: 1rem; height: 32px; }
        .app-version {
            position: fixed;
            bottom: 3rem;
            left: 1rem;
            font-size: 0.65rem;
            font-weight: 600;
            letter-spacing: 0.06em;
            color: var(--text-dim);
            opacity: 0.5;
            z-index: 101;
        }
        /* In custom la versione va appena sopra il tasto menu (☰) in alto a
           sinistra, così non occupa spazio in fondo sotto la barra ANSA. */
        body.custom-layout .app-version { top: 0.15rem; left: 1.1rem; bottom: auto; right: auto; }
        .theme-track {
            width: 28px; height: 16px;
            background: var(--track);
            border-radius: var(--radius-sm);
            position: relative;
            transition: background .2s;
            flex-shrink: 0;
        }
        .theme-track::after {
            content: '';
            position: absolute;
            width: 11px; height: 11px;
            background: var(--track-thumb);
            border-radius: 50%;
            top: 2.5px; left: 2.5px;
            transition: transform .2s;
        }
        body.dark .theme-track { background: #22c55e; }
        body.dark .theme-track::after { transform: translateX(12px); }

        /* Engine selector */
        .engine-btn {
            background: none;
            border: none;
            border-right: 1px solid var(--divider);
            padding: 0.1rem 0.75rem 0.1rem 0;
            margin-right: 0.75rem;
            color: var(--text);
            cursor: pointer;
            font-size: 0.75rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            flex-shrink: 0;
            opacity: 0.65;
            transition: opacity .15s;
            white-space: nowrap;
        }
        .engine-btn:hover { opacity: 1; }

        /* Search bar — fixed top, centered pill */
        .search-form {
            position: fixed;
            top: 0.75rem;
            left: 50%;
            transform: translateX(-50%);
            width: min(760px, calc(100% - 2rem));
            z-index: 100;
            display: flex;
            align-items: center;
            background: var(--glass);
            backdrop-filter: blur(20px);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 0.45rem 0.6rem 0.45rem 1.4rem;
            gap: 0;
            transition: background .4s, border-color .4s;
        }
        .search-form:focus-within {
            border-color: var(--card-hover-border);
            background: var(--card-hover);
        }
        .search-form input {
            flex: 1;
            background: none;
            border: none;
            outline: none;
            color: var(--input-text);
            font-size: 0.92rem;
            min-width: 0;
            padding: 0.3rem 0;
        }
        .search-form input::placeholder { color: var(--placeholder); }
        .search-form > button[type="submit"] {
            background: var(--btn);
            border: none;
            border-radius: var(--radius-sm);
            padding: 0.3rem 0.85rem;
            color: var(--text);
            cursor: pointer;
            font-size: 0.95rem;
            transition: background .15s;
            flex-shrink: 0;
        }
        .search-form > button[type="submit"]:hover { background: var(--btn-hover); }
        .search-form > button[type="submit"] svg { display: block; width: 17px; height: 17px; }

        /* View dropdown */
        /* Cluster in alto a sinistra: menu + login/logout + nome utente */
        .topbar {
            position: fixed;
            top: 1rem;
            left: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            z-index: 60;
        }
        /* In personalizzazione la topbar diventa una "fetta" della pagina: fascia
           a tutta larghezza, sfondo uniforme semitrasparente, fissa in alto; i
           widget scorrono sotto. A destra resta spazio per il toggle tema. */
        body.widget-editing .topbar {
            top: 0;
            left: 0;
            right: 0;
            flex-wrap: nowrap;
            /* padding-top 1rem = stessa altezza dei pulsanti in visualizzazione
               (che stanno a top:1rem), così i controlli non "saltano". */
            padding: 1rem 1rem 0.55rem;
            /* Stesso sfondo della pagina (fixed = combacia col gradiente sotto):
               sembra una "fetta" della pagina, opaca, sotto cui scorrono i widget. */
            background: linear-gradient(135deg, var(--bg-from) 0%, var(--bg-to) 100%);
            background-attachment: fixed;
            box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
            z-index: 95;
        }
        /* Niente toggle tema durante la personalizzazione. */
        body.widget-editing .theme-toggle { display: none; }
        /* Dashboard multi-pagina: barra delle tab tra il menu e "Personalizza". */
        .page-tabs {
            display: flex; align-items: center; gap: 0.3rem;
            max-width: 52vw; overflow-x: auto; scrollbar-width: thin;
        }
        .page-tab {
            display: inline-flex; align-items: center; gap: 0.3rem;
            background: transparent; border: none;
            border-bottom: 2px solid transparent;
            border-radius: var(--radius-sm) var(--radius-sm) 0 0;
            padding: 0.35rem 0.7rem;
            color: var(--text-dim); font-size: 0.78rem; font-weight: 600;
            cursor: pointer; white-space: nowrap; user-select: none;
            transition: color .15s, border-color .15s, background .15s;
        }
        .page-tab:hover { background: var(--tab-hover-bg); color: var(--text); }
        .page-tab.active { color: var(--text); border-bottom-color: #22c55e; background: var(--tab-active-bg); }
        .page-tab.dragging { opacity: 0.5; }
        .page-tabs.editing .page-tab { cursor: grab; }
        .page-tab-label { outline: none; }
        .page-tab-label[contenteditable="true"] { cursor: text; min-width: 2rem; }
        .page-tab-del {
            background: none; border: none; color: var(--text-dim); cursor: pointer;
            font-size: 0.95rem; line-height: 1; padding: 0 0.1rem;
        }
        .page-tab-del:hover { color: #ef4444; }
        .page-tab-add {
            flex-shrink: 0;
            background: var(--btn); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
            font-size: 1rem; line-height: 1; width: 28px; height: 28px;
        }
        .page-tab-add:hover { background: var(--btn-hover); }
        .page-tab-add:disabled { opacity: 0.4; cursor: default; }
        .view-menu { position: relative; }
        .view-menu-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0;
            color: var(--text);
            cursor: pointer;
            opacity: 0.6;
            transition: opacity .15s, background .15s;
        }
        .view-menu-btn:hover { opacity: 1; background: var(--btn-hover); }
        .view-menu-btn svg { width: 15px; height: 15px; }
        .view-menu-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 0.35rem);
            left: 0;
            background: var(--bg-to);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            overflow: hidden;
            box-shadow: 0 8px 24px rgba(0,0,0,0.35);
            width: max-content;
            min-width: 130px;
            max-width: 16rem;
            z-index: 50;
        }
        .view-menu-dropdown.open { display: block; }
        .view-menu-item {
            display: block;
            width: 100%;
            background: none;
            border: none;
            padding: 0.5rem 1rem;
            color: var(--text);
            font-size: 0.78rem;
            font-weight: 600;
            text-align: left;
            white-space: nowrap;
            cursor: pointer;
            font-family: inherit;
            opacity: 0.7;
            transition: background .15s, opacity .15s;
        }
        .view-menu-item:hover { background: var(--card-hover); opacity: 1; }
        .view-menu-item.active { opacity: 1; color: #22c55e; }
        /* voci accessibili solo agli admin: badge "ADMIN" (::before, ::after è usato da has-alert) */
        .view-menu-item.admin-only {
            display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
        }
        .view-menu-item.admin-only::before {
            content: 'ADMIN'; order: 2;
            font-size: 0.52rem; font-weight: 700; letter-spacing: 0.06em;
            padding: 0.08rem 0.32rem; border-radius: var(--radius-sm);
            background: var(--glass); border: 1px solid var(--glass-border);
            color: var(--text-dim);
        }

        /* News ticker */
        .ticker-bar {
            position: fixed;
            bottom: 0; left: 0; right: 0;
            height: 2.4rem;
            background: var(--glass);
            backdrop-filter: blur(16px);
            border-top: 1px solid var(--glass-border);
            display: flex;
            align-items: center;
            overflow: hidden;
            z-index: 50;
            font-size: 0.82rem;
            transition: background .4s, border-color .4s;
        }
        .ticker-label {
            padding: 0 1rem;
            font-weight: 800;
            font-size: 0.7rem;
            letter-spacing: 0.12em;
            color: var(--text);
            text-transform: uppercase;
            flex-shrink: 0;
            border-right: 1px solid var(--divider);
            height: 100%;
            display: flex;
            align-items: center;
        }
        .ticker-wrap {
            flex: 1;
            overflow: hidden;
            height: 100%;
            display: flex;
            align-items: center;
        }
        .ticker-track {
            display: flex;
            white-space: nowrap;
            animation: ticker-scroll linear infinite;
        }
        .ticker-track a {
            color: var(--ticker-link);
            text-decoration: none;
            padding: 0 2rem;
            transition: color .15s;
        }
        .ticker-track a:hover { color: var(--text); }
        .ticker-sep { color: var(--text); margin-right: 0.5rem; font-size: 0.55rem; vertical-align: middle; }
        @keyframes ticker-scroll {
            0%   { transform: translateX(0); }
            100% { transform: translateX(-50%); }
        }

        /* Login button */
        /* login/logout: stesso stile del pulsante menu (.view-menu-btn) */
        .login-btn,
        .logout-btn {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            height: 32px;
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0 0.7rem;
            color: var(--text);
            font-family: inherit;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            opacity: 0.6;
            transition: opacity .15s, background .15s;
        }
        .login-btn:hover,
        .logout-btn:hover { opacity: 1; background: var(--btn-hover); }
        .login-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
        .auth-badge {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        /* Pillola utente: coerente con i pulsanti (altezza/raggio) ma più discreta */
        .auth-user {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            height: 32px;
            padding: 0 0.75rem 0 0.55rem;
            border-radius: var(--radius-sm);
            background: rgba(255,255,255,0.06);
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--text);
            white-space: nowrap;
        }
        .auth-user-icon {
            width: 15px;
            height: 15px;
            opacity: 0.65;
            flex-shrink: 0;
        }
        /* Countdown della sessione */
        .session-timer {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.72rem;
            color: var(--text-dim);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }
        .session-timer.expiring { color: #f59e0b; }
        .session-timer-icon { width: 13px; height: 13px; opacity: 0.7; flex-shrink: 0; }

        /* Auth modal */
        .auth-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.55);
            backdrop-filter: blur(4px);
            z-index: 200;
            align-items: center;
            justify-content: center;
        }
        .auth-overlay.open { display: flex; }
        .auth-box {
            background: var(--bg-to);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            padding: 2rem 2rem 1.6rem;
            width: min(360px, calc(100% - 2rem));
            box-shadow: 0 16px 48px rgba(0,0,0,0.4);
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .auth-title {
            font-size: 1rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            color: var(--text);
            margin-bottom: .2rem;
        }
        .auth-box input {
            width: 100%;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: .6rem .9rem;
            color: var(--input-text);
            font-size: .92rem;
            outline: none;
            transition: border-color .15s;
        }
        .auth-box input:focus { border-color: var(--card-hover-border); }
        .auth-box input::placeholder { color: var(--placeholder); }
        /* Modale aggiorna documento */
        .doc-label { text-align: left; font-size: 0.72rem; color: var(--text-dim); margin: -0.6rem 0 -0.5rem; }
        .auth-box input[type="file"] { font-size: 0.82rem; padding: 0.5rem 0.6rem; cursor: pointer; }
        .auth-box input[type="date"] { color-scheme: dark; }
        /* Modali gestione: select come gli input, gruppi condizionali, checkbox */
        .auth-box select {
            width: 100%;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.55rem 0.8rem;
            color: var(--input-text);
            font-size: 0.9rem;
            outline: none;
            cursor: pointer;
        }
        .auth-box select:focus { border-color: var(--card-hover-border); }
        .auth-box select option { background: var(--bg-to); color: var(--text); }
        #itemLinkFields, #itemDocFields { display: flex; flex-direction: column; gap: 1rem; }
        #itemOverlay .auth-box { width: min(420px, calc(100% - 2rem)); max-height: 90vh; overflow-y: auto; }
        .manage-check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text); text-align: left; cursor: pointer; }
        .manage-check input { width: auto; }

        /* Pannello "Gestione contenuti" */
        #manageTree { display: flex; flex-direction: column; }
        .mg-row {
            display: flex; align-items: center; gap: 0.6rem;
            padding: 0.4rem 1rem;
            border-bottom: 1px solid var(--glass-border);
            font-size: 0.85rem;
            text-align: left;
        }
        .mg-folder { font-weight: 600; }
        .mg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .mg-folder-icon { display: inline-flex; vertical-align: -0.15em; }
        .mg-folder-icon img { width: 0.95rem; height: 0.95rem; }
        .mg-flags { font-size: 0.7rem; color: var(--text-dim); white-space: nowrap; }
        .mg-tools { display: flex; gap: 0.25rem; flex-shrink: 0; }
        .mg-btn {
            background: var(--glass); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text);
            width: 1.7rem; height: 1.7rem; padding: 0; cursor: pointer;
            font-size: 0.8rem; line-height: 1; opacity: 0.8;
            transition: background .15s, opacity .15s;
        }
        .mg-btn img { width: 0.9rem; height: 0.9rem; vertical-align: middle; }
        .mg-btn:hover { opacity: 1; background: var(--btn); }
        .mg-btn.danger:hover { background: #ef4444; border-color: #ef4444; color: #fff; }
        .manage-empty { color: var(--text-dim); padding: 1rem; text-align: center; }
        #manageError:empty { display: none; }
        /* tab Contenuti/Utenti dentro Gestione */
        /* Intestazione Gestione = barra di linguette (tab canonici) a sinistra. */
        .manage-header { display: block; padding: 0 1rem; }
        .manage-tabs {
            display: flex; gap: 0.2rem;
            border-bottom: 1px solid var(--glass-border);
        }
        .mtab {
            background: transparent; border: none;
            border-bottom: 2px solid transparent;
            border-radius: var(--radius-sm) var(--radius-sm) 0 0;
            color: var(--text-dim); padding: 0.6rem 0.9rem; margin-bottom: -1px;
            font: inherit; font-size: 0.78rem; font-weight: 600;
            cursor: pointer; opacity: 1; transition: color .15s, border-color .15s, background .15s;
        }
        .mtab:hover { color: var(--text); background: var(--tab-hover-bg); }
        .mtab.active { color: var(--text); border-bottom-color: #22c55e; background: var(--tab-active-bg); }
        .manage-actions { display: flex; gap: 0.5rem; margin-bottom: 0.6rem; padding: 0 1rem; }
        /* Footer col pulsante Salva unico (tab Widget/Menu): in fondo, a destra. */
        .mg-widgets-footer { margin-top: 0.9rem; margin-bottom: 0.3rem; justify-content: flex-end; }
        .mg-widgets-footer .mg-btn { width: auto; padding: 0.4rem 1.1rem; }
        #manageError { padding: 0 1rem; }
        .mg-warn { color: #f59e0b; }
        /* tab Menu: rinomina + permessi + ordine */
        .manage-hint { color: var(--text-dim); font-size: 0.75rem; padding: 0 1rem 0.6rem; text-align: left; }
        .mg-menu .mg-handle { cursor: grab; color: var(--text-dim); flex-shrink: 0; user-select: none; }
        .mg-menu.dragging { opacity: 0.45; }
        .mg-menu-label {
            flex: 0 0 8rem; min-width: 0; background: var(--glass);
            border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
            color: var(--text); padding: 0.25rem 0.45rem; font: inherit; font-size: 0.8rem;
        }
        .mg-menu-ctrl { flex: 1; display: flex; gap: 0.4rem; align-items: center; min-width: 0; }
        .mg-menu-mode {
            background: var(--glass); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text);
            padding: 0.25rem 0.4rem; font: inherit; font-size: 0.78rem; flex-shrink: 0;
        }
        .mg-menu-mode option { background: var(--bg-to); color: var(--text); }
        .mg-menu-users {
            flex: 1; min-width: 0; background: var(--glass);
            border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
            color: var(--text); padding: 0.25rem 0.45rem; font: inherit; font-size: 0.78rem;
        }
        .mg-menu .mg-btn { width: auto; padding: 0 0.6rem; flex-shrink: 0; }
        /* Riga widget (tab Widget): checkbox di abilitazione + nome a larghezza fissa. */
        .mg-wg-enable { flex-shrink: 0; width: 1.05rem; height: 1.05rem; accent-color: #22c55e; cursor: pointer; }
        .mg-menu .mg-name { flex: 0 0 9.5rem; }
        /* drag & drop */
        .mg-row[draggable="true"] { cursor: grab; }
        .mg-row.mg-dragging { opacity: 0.45; }
        .mg-row.mg-drop-before { box-shadow: inset 0 3px 0 0 #22c55e; }
        .mg-row.mg-drop-after  { box-shadow: inset 0 -3px 0 0 #22c55e; }
        .mg-row.mg-drop-into   { background: rgba(34,197,94,0.16); box-shadow: inset 0 0 0 1px #22c55e; }
        .auth-btn {
            width: 100%;
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: .6rem;
            color: var(--text);
            font-size: .9rem;
            font-weight: 600;
            cursor: pointer;
            transition: background .15s;
        }
        .auth-btn:hover { background: var(--btn-hover); }
        .auth-error {
            font-size: .78rem;
            color: #ef4444;
            min-height: 1.1em;
            text-align: center;
        }
        .auth-cancel {
            text-align: center;
            font-size: .75rem;
            color: var(--text-dim);
            cursor: pointer;
            opacity: .7;
        }
        .auth-cancel:hover { opacity: 1; }
        #authTotpRow { display: none; }

        @media (max-width: 600px) {
            .folder-grid { grid-template-columns: repeat(2, 1fr); }
        }
        .hidden { display: none; }

        /* Network scan panel */
        .scan-panel {
            margin-top: 1.5rem;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            overflow: hidden;
            backdrop-filter: blur(10px);
        }
        .scan-header {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.75rem 1rem;
            text-align: left;
        }
        .scan-title {
            font-size: 0.78rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-dim);
            flex: 1;
        }
        .scan-range {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.35rem 1rem 0;
            font-size: 0.68rem;
            font-family: monospace;
            color: var(--text);
            opacity: 0.85;
            text-align: left;
        }
        .scan-phase {
            font-family: 'Segoe UI', Tahoma, sans-serif;
            font-size: 0.62rem;
            color: var(--text);
            opacity: 0.95;
        }
        .scan-btn {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.25rem 0.8rem;
            color: var(--text);
            font-size: 0.72rem;
            font-weight: 600;
            cursor: pointer;
            transition: background .15s;
            font-family: inherit;
        }
        .scan-btn:hover:not(:disabled) { background: var(--btn-hover); }
        .scan-btn:disabled { opacity: 0.5; cursor: default; }
        .scan-body {
            border-top: 1px solid var(--glass-border);
            padding: 0.5rem 0;
        }
        .scan-row {
            padding: 0.35rem 1rem;
            font-size: 0.8rem;
            transition: background .1s;
        }
        .scan-row:hover { background: var(--card); }
        .scan-row-top {
            display: grid;
            grid-template-columns: 10px 130px 1fr;
            column-gap: 0.75rem;
            align-items: center;
        }
        .scan-row-ports {
            display: flex;
            flex-wrap: wrap;
            gap: 0.2rem;
            padding: 0.28rem 0 0.05rem calc(140px + 1.5rem);
        }
        .scan-dot {
            width: 8px; height: 8px;
            border-radius: 50%;
            background: #22c55e;
            flex-shrink: 0;
        }
        .scan-ip { font-family: monospace; font-size: 0.78rem; }
        .scan-hostname {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            overflow: hidden;
            min-width: 0;
        }
        .scan-hostname > span:not(.scan-device):not(.scan-note) {
            color: var(--text-dim);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            min-width: 0;
        }
        .scan-device {
            font-size: 0.58rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            background: rgba(99,179,237,0.1);
            color: #63b3ed;
            border: 1px solid rgba(99,179,237,0.2);
            border-radius: 4px;
            padding: 0.05rem 0.32rem;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .scan-note {
            font-size: 0.55rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            color: #f59e0b;
            background: rgba(245,158,11,0.12);
            border: 1px solid rgba(245,158,11,0.3);
            border-radius: 4px;
            padding: 0.05rem 0.3rem;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .scan-rtt { font-size: 0.68rem; color: var(--text-dim); opacity: 0.5; white-space: nowrap; }
        .scan-port {
            font-size: 0.62rem;
            font-family: monospace;
            background: rgba(34,197,94,0.08);
            color: #22c55e;
            border: 1px solid rgba(34,197,94,0.2);
            border-radius: 4px;
            padding: 0.05rem 0.35rem;
            white-space: nowrap;
        }
        .scan-progress {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.6rem 0.1rem 1rem;
        }
        .scan-progress.hidden { display: none; }
        .scan-progress-track {
            flex: 1;
            height: 2px;
            background: var(--glass-border);
            border-radius: 1px;
            overflow: hidden;
        }
        .scan-progress-fill {
            height: 100%;
            background: #22c55e;
            border-radius: 1px;
            width: 0%;
            transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .scan-progress.indeterminate .scan-progress-fill {
            width: 35% !important;
            transition: none;
            animation: scan-shimmer 1.4s ease-in-out infinite;
        }
        @keyframes scan-shimmer {
            0%   { transform: translateX(-200%); }
            100% { transform: translateX(370%); }
        }
        .scan-progress-label {
            font-size: 0.72rem;
            font-family: monospace;
            color: var(--text);
            opacity: 0.9;
            min-width: 2rem;
            text-align: right;
        }
        .scan-footer {
            padding: 0.4rem 1rem;
            font-size: 0.68rem;
            color: var(--text-dim);
            opacity: 0.6;
            border-top: 1px solid var(--glass-border);
        }
        /* Diff tra scansioni */
        .scan-new {
            font-size: 0.55rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            color: #ef4444;
            background: rgba(239,68,68,0.12);
            border: 1px solid rgba(239,68,68,0.3);
            border-radius: 4px;
            padding: 0.05rem 0.3rem;
        }
        .scan-missing { opacity: 0.45; }
        .scan-diff-sep {
            padding: 0.55rem 1rem 0.2rem;
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            text-transform: uppercase;
            color: var(--text-dim);
            text-align: left;
        }

        .scan-loading, .scan-error {
            padding: 0.75rem 1rem;
            font-size: 0.8rem;
            color: var(--text-dim);
        }
        .scan-error { color: #ef4444; }

        /* Widget Proxmox */
        .scan-dot.off { background: var(--text-dim); }
        .pve-node {
            font-size: 0.68rem;
            font-family: monospace;
            color: var(--text-dim);
        }
        .pve-stats {
            display: flex;
            flex-direction: column;
            gap: 0.45rem;
            padding: 0.5rem 1rem 0.7rem;
        }
        .pve-stat {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            font-size: 0.7rem;
        }
        .pve-stat-label {
            width: 3rem;
            color: var(--text-dim);
            font-weight: 600;
        }
        .pve-stat-track {
            flex: 1;
            height: 6px;
            border-radius: 3px;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            overflow: hidden;
        }
        .pve-stat-fill {
            height: 100%;
            background: #22c55e;
            transition: width .4s;
        }
        .pve-stat-fill.warn { background: #f59e0b; }
        .pve-stat-fill.crit { background: #ef4444; }
        /* Barre fatturato: colore fisso (più alto ≠ allarme). */
        .pve-stat-fill.ef-bar { background: #3b82f6; }
        .pve-stat-value {
            min-width: 7.5rem;
            text-align: right;
            color: var(--text-dim);
            font-variant-numeric: tabular-nums;
        }
        .pve-guest .scan-row-top { cursor: pointer; }
        .pve-detail {
            padding: 0.35rem 1rem 0.6rem 2.1rem;
            text-align: left;
        }
        .pve-detail-meta {
            font-size: 0.66rem;
            color: var(--text-dim);
        }
        .pve-charts {
            display: flex;
            flex-wrap: wrap;
            gap: 0.8rem;
            margin-top: 0.5rem;
        }
        .pve-chart {
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
        }
        .pve-chart-head {
            display: flex;
            justify-content: space-between;
            font-size: 0.6rem;
            color: var(--text-dim);
            font-weight: 600;
        }
        .pve-chart-val { font-variant-numeric: tabular-nums; }
        .pve-chart canvas {
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: 6px;
        }

        /* ===================================================================
           Dashboard personalizzabile a widget (layout a colonne, desktop).
           =================================================================== */
        /* Anti-flash: finché dashboard.js non decide il layout (utente custom),
           si tiene nascosto il contenuto mostrando solo lo sfondo del body. */
        html.layout-pending .container,
        html.layout-pending .search-form,
        html.layout-pending .theme-toggle,
        html.layout-pending .ticker-bar { visibility: hidden; }

        /* In custom la ricerca è un widget (non più la barra fissa in alto):
           riduco il padding superiore del body, lasciando spazio solo alla topbar. */
        body.custom-layout { padding-top: 3.6rem; padding-bottom: 0; }
        /* In modalità custom la dashboard sfonda il riquadro centrato e occupa
           tutta la pagina: niente cornice/sfondo, larghezza piena. */
        body.custom-layout .container {
            width: 100%;
            max-width: none;
            padding: 0.4rem 0 0;   /* solo la spaziatura tra widget è impostabile (gap);
                                      il padding-top evita il margin-collapse del grid */
            background: none;
            border: none;
            box-shadow: none;
            backdrop-filter: none;
            border-radius: 0;
        }
        .widget-hidden { display: none !important; }

        .customize-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            height: 32px;
            min-width: 8.5rem;   /* "Fine" resta largo come "Personalizza" */
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0 0.7rem;
            color: var(--text);
            font-family: inherit;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            opacity: 0.6;
            transition: opacity .15s, background .15s;
        }
        .customize-btn:hover { opacity: 1; background: var(--btn-hover); }
        .customize-btn.active { opacity: 1; background: var(--btn-hover); color: #22c55e; }
        .customize-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
        /* In vista classica "Personalizza" va a destra della barra (in custom resta
           nella topbar a sinistra; lì il toggle tema è già a destra). */
        body:not(.custom-layout) .customize-btn {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 101;
        }
        /* .hidden è definito prima: serve il selettore composto per vincere su display:flex. */
        .customize-btn.hidden { display: none; }

        .widget-grid {
            display: grid;
            /* grid-template-columns e grid-auto-rows impostati via JS:
               righe ad altezza UNIFORME → niente accoppiamento di altezza. */
            align-items: stretch;
            gap: 1.2rem;
            width: 100%;
            text-align: left;
        }
        .widget {
            position: relative;
            min-width: 0;
            display: flex;
            flex-direction: column;
            background: var(--glass);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            backdrop-filter: blur(10px);
            overflow: hidden;
        }
        /* Il corpo riempie l'area del widget; se il contenuto eccede, scorre ma
           senza barra visibile (scrollbar nascoste su tutti i browser). */
        .widget > .widget-body {
            flex: 1;
            overflow: auto;
            scrollbar-width: none;          /* Firefox */
            -ms-overflow-style: none;       /* Edge legacy */
        }
        .widget > .widget-body::-webkit-scrollbar { width: 0; height: 0; display: none; }
        /* Celle vuote: slot statici sempre presenti (guida + zona di drop). */
        .widget-cell {
            border: 1px dashed var(--glass-border);
            border-radius: var(--radius-sm);
            opacity: 0.4;
        }
        /* Sfondo e bordo sono scelte indipendenti per-widget (toggle in modifica). */
        .widget-nobg { background: none; backdrop-filter: none; }
        .widget-noborder { border: none; }
        /* --- Widget collassabili --- */
        /* Occupano sempre 1 riga (la barra titolo). Da espanso il contenuto esce. */
        .widget.collapsible { overflow: visible; }
        .widget-collbar {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.7rem;
            cursor: pointer;
        }
        .widget-collbar .widget-title { font-size: 0.72rem; }
        /* Collassato: la barra riempie la cella (1 riga); il corpo è nascosto. */
        .widget.collapsible > .widget-collbar { height: 100%; }
        .widget.collapsible > .widget-body { display: none; }
        /* Meteo fuso: il compatto (condizioni attuali) vive nella collbar; quando
           "parcheggiato" (Meteo non collassabile = solo esteso) resta nascosto. */
        .widget-wsummary-off { display: none !important; }
        .widget-collbar .weather-wrapper { margin: 0; flex: 1; min-width: 0; }
        .widget-collbar .weather { justify-content: flex-start; }
        /* Espanso: la cella fa solo da ancora (trasparente); barra + contenuto sono
           un'unica card a comparsa (overlay con ombra) sopra i widget sotto. */
        .widget.collapsible.expanded {
            background: none;
            border: none;
            backdrop-filter: none;
            z-index: 30;
        }
        .widget-pop {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            z-index: 30;
            display: flex;
            flex-direction: column;
            max-height: 75vh;
            overflow: hidden;
            background: var(--bg-to);   /* opaco: copre i widget sottostanti */
            border: 1px solid var(--glass-border);
            border-radius: var(--radius);
            box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55);
        }
        .widget-pop > .widget-collbar { border-bottom: 1px solid var(--glass-border); }
        .widget-pop > .widget-body { display: block; flex: 1; overflow: auto; }
        /* Niente titolo doppio: nasconde l'intestazione propria del contenuto. */
        .widget.collapsible .scan-title,
        .widget.collapsible .group-label { display: none; }
        /* Espanso: il titolo lo dà già la barra del popover. Nascondo il titolo
           interno (semplice = tutto; con header+pulsanti = solo il testo, tengo il ⟳). */
        .widget-pop .wx-htitle:not(.wx-host-head) { display: none; }
        .widget-pop .wx-host-head { margin-bottom: 0; justify-content: flex-end; }
        .widget-pop .wx-host-head > :first-child { display: none; }
        /* Logo ridimensionabile a mano: il frame fissa la larghezza, l'immagine la
           segue mantenendo le proporzioni. In editazione, maniglia all'angolo. */
        .widget[data-type="logo"] > .widget-body { align-items: center; }
        .logo-frame { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
        /* Selettore più specifico per battere `.widget-body .logo { max-width:160px }`
           e permettere al logo di scalare oltre i 160px (fino alla cella). */
        .widget-body .logo-frame .logo { width: 100%; height: auto; max-width: 100%; margin: 0; display: block; }
        .logo-frame.logo-snap { outline: 1px dashed #22c55e; outline-offset: 3px; }
        .logo-pct {
            position: absolute; left: 50%; bottom: -1.4rem; transform: translateX(-50%);
            font-size: 0.7rem; font-variant-numeric: tabular-nums; color: var(--text-dim);
            background: rgba(0, 0, 0, 0.6); padding: 0.05rem 0.35rem; border-radius: var(--radius-sm);
            pointer-events: none; white-space: nowrap;
        }
        /* Chevron flottante per i widget collassabili espansi (niente barra titolo). */
        .widget-chev--float {
            position: absolute; top: 4px; right: 4px; z-index: 6;
            background: rgba(0, 0, 0, 0.45);
        }
        .widget-chev--float:hover { background: rgba(0, 0, 0, 0.7); color: var(--text); }
        .logo-resize {
            position: absolute; right: -5px; bottom: -5px;
            width: 14px; height: 14px; cursor: nwse-resize; z-index: 6;
            border-right: 2px solid var(--text); border-bottom: 2px solid var(--text);
            opacity: 0.7;
        }
        /* Cartella: colonne degli elementi. Default dinamico (auto-fill in base alla
           larghezza del widget). Niente scroll orizzontale: il min cap a 100%. */
        .widget .folder-grid { grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr)); }
        /* Numero fisso (--fcols impostato inline): le card si restringono (min 0). */
        .widget[style*="--fcols"] .folder-grid { grid-template-columns: repeat(var(--fcols), minmax(0, 1fr)); }
        .widget-body { padding: 1rem; }
        .widget[data-type="pve"] > .widget-body,
        .widget[data-type="scan"] > .widget-body,
        .widget[data-type="logo"] > .widget-body { padding: 0; }
        /* ANSA: margini interni ridotti (la barra news riempie meglio il widget). */
        .widget[data-type="ansa"] > .widget-body { padding: 0.2rem 0.5rem; }
        /* Le cartelle (widget folder:*) non devono toccare i bordi: respiro. */
        .widget[data-type^="folder:"] > .widget-body { padding: 0 0.75rem; }
        /* La pool servicesGrid è nascosta in custom: le cartelle vivono nei widget. */
        body.custom-layout #servicesGrid { display: none !important; }
        .widget-body .logo { display: block; margin: 0 auto; max-width: 160px; }
        .widget[data-type="logo"] > .widget-body { padding: 0.8rem 0; }
        .widget-body .services { margin: 0; }
        /* I pannelli pve/scan dentro un widget non portano sfondo proprio: lo
           sfondo lo dà (eventualmente) il widget stesso. */
        .widget-body .scan-panel {
            margin-top: 0;
            background: transparent;
            border: none;
            backdrop-filter: none;
        }
        /* Cartella in widget: titolo a sinistra come gli altri widget, niente linee
           decorative, controlli (vista/ricerca) a destra; niente collasso. */
        .widget-body .group-separator {
            margin: 0.5rem 0 0.6rem;
            grid-template-columns: auto 1fr;
            gap: 0.5rem;
            font-size: 0.72rem;
            letter-spacing: 0.06em;
            opacity: 0.7;
            cursor: default;
        }
        .widget-body .group-separator::before { display: none; }
        .widget-body .sep-line { display: none; }
        .widget-body .sep-right { justify-content: flex-end; }
        .widget-body .group-chevron { display: none; }

        /* --- Widget "extra" (scadenze, host, meteo esteso, note) --- */
        .wx { width: 100%; }
        .wx-htitle {
            font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
            text-transform: uppercase; color: var(--text-dim);
            margin-bottom: 0.5rem;
        }
        /* Intestazione widget host: titolo + pulsante refresh. */
        .wx-host-head { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
        .wx-refresh {
            background: none; border: none; color: var(--text-dim); cursor: pointer;
            font-size: 0.95rem; line-height: 1; padding: 0 0.2rem; border-radius: var(--radius-sm);
        }
        .wx-refresh:hover { color: var(--text); }
        .wx-refresh.spin { animation: wx-spin 0.7s linear infinite; }
        /* Pulsanti dell'header host "a pacco" a destra (refresh + pulizia admin). */
        .wx-host-actions { display: flex; align-items: center; gap: 0.1rem; flex-shrink: 0; }
        .wx-refresh:disabled { opacity: 0.45; cursor: default; }
        .wx-refresh svg { width: 14px; height: 14px; display: block; }
        @keyframes wx-spin { to { transform: rotate(360deg); } }
        /* Allinea i titoli dei pannelli pve/scan nel widget allo stile .wx-htitle. */
        .widget-body .scan-title { font-size: 0.72rem; }
        .wx-body { display: flex; flex-direction: column; gap: 0.15rem; }
        .wx-row {
            display: flex; align-items: center; justify-content: space-between;
            gap: 0.5rem; padding: 0.28rem 0; font-size: 0.85rem;
            border-bottom: 1px solid var(--divider);
        }
        .wx-row:last-child { border-bottom: none; }
        .wx-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .wx-badge {
            flex-shrink: 0; font-size: 0.7rem; font-weight: 600;
            padding: 0.1rem 0.45rem; border-radius: var(--radius-sm);
            background: var(--card); color: var(--text-dim);
        }
        .wx-badge.warn { color: #f59e0b; }
        .wx-badge.bad { color: #ef4444; }
        .wx-empty, .wx-sub { color: var(--text-dim); font-size: 0.8rem; padding: 0.2rem 0; }
        .wx-ef-upd { color: var(--text-dim); opacity: 0.7; font-size: 0.68rem; margin-top: 0.25rem; }
        /* EasyFatt Fatturato — tab "Grafico": cumulato anno-su-anno (SVG nativo). */
        .wx-rev-chartwrap { flex: 1; min-height: 110px; min-width: 0; display: flex; }
        .wx-rev-chart { width: 100%; height: 100%; }
        .wx-rev-axis { fill: var(--text-dim); font-size: 7px; font-family: inherit; }
        .wx-rev-grid { stroke: var(--glass-border); stroke-width: 0.5; }
        .wx-rev-ref { stroke: var(--text-dim); stroke-width: 0.6; stroke-dasharray: 2 2; opacity: 0.6; }
        .wx-rev-line { fill: none; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; }
        .wx-rev-line.cur { stroke-width: 2.2; }
        .wx-rev-legend { display: flex; flex-wrap: wrap; gap: 0.5rem; font-size: 0.66rem; margin-top: 0.35rem; }
        .wx-rev-leg { display: flex; align-items: center; gap: 0.25rem; color: var(--text-dim); }
        .wx-rev-sw { width: 11px; height: 3px; border-radius: 2px; flex-shrink: 0; }
        /* Widget QR Code aziendale (due tab: QR + Dati). */
        .wx-qr { height: 100%; display: flex; flex-direction: column; }
        .wx-qr-body { flex: 1; min-height: 0; display: flex; }
        /* Pannello QR: immagine centrata, scalata mantenendo le proporzioni alla
           cella. Sfondo bianco + padding = "quiet zone" per la scansione. */
        .wx-qr-pane { flex: 1; min-height: 0; width: 100%; display: flex; align-items: center; justify-content: center; }
        .wx-qr-img {
            max-width: 100%; max-height: 100%;
            width: auto; height: auto;
            object-fit: contain;
            background: #fff; padding: 0.5rem; border-radius: 8px;
        }
        /* Pannello Dati: lista etichetta→valore decodificata dal QR, scrollabile. */
        .wx-qr-data { flex: 1; min-height: 0; width: 100%; overflow: auto; }
        .wx-qr-dl { display: flex; flex-direction: column; gap: 0.4rem; }
        .wx-qr-drow { display: flex; flex-direction: column; gap: 0.05rem; }
        .wx-qr-dk { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-dim); }
        .wx-qr-dv { font-size: 0.82rem; color: var(--text); word-break: break-word; }
        /* Temperatura disco QNAP: colore per soglia, colonna allineata a destra. */
        .wx-qnap-temp {
            flex-shrink: 0; min-width: 3rem; text-align: right;
            font-size: 0.74rem; font-variant-numeric: tabular-nums; color: var(--text-dim);
        }
        .wx-qnap-temp.warn { color: #f59e0b; }
        .wx-qnap-temp.crit { color: #ef4444; }
        /* Badge (stato/salute) a larghezza fissa: colonne allineate tra le righe. */
        .wx-qnap .wx-badge { min-width: 4.5rem; text-align: center; }
        /* Widget Termostati Tuya. */
        .wx-tuya-item { padding: 0.35rem 0; border-bottom: 1px solid var(--glass-border); }
        .wx-tuya-item:last-child { border-bottom: none; }
        .wx-tuya-top { display: flex; align-items: center; gap: 0.5rem; }
        .wx-tuya-top .wx-name { flex: 1; min-width: 0; }
        .wx-tuya-right { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
        .wx-tuya-flame { font-size: 0.85rem; }
        .wx-tuya-tag {
            font-size: 0.58rem; font-weight: 700; letter-spacing: 0.03em;
            padding: 0.05rem 0.3rem; border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text-dim);
        }
        .wx-tuya-temps { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.15rem; }
        .wx-tuya-cur { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 4rem; }
        .wx-tuya-cur.heating { color: #f59e0b; }
        .wx-tuya-set { font-size: 0.74rem; color: var(--text-dim); min-width: 3.4rem; text-align: center; }
        /* On/Off come switch (stile selettore tema/fit), compatto senza pillola. */
        .wp-switch.wx-tuya-toggle { background: none; border: none; padding: 0; }
        .wx-tuya-state { font-size: 0.72rem; font-weight: 600; color: var(--text-dim); }
        .wx-tuya-state.on { color: #22c55e; }
        .wx-tuya-step {
            width: 1.4rem; height: 1.4rem; line-height: 1; flex-shrink: 0;
            background: var(--btn); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-size: 0.95rem;
        }
        .wx-tuya-step:hover { background: var(--btn-hover); }
        .wx-tuya-spark { width: 100%; height: 26px; margin-top: 0.3rem; display: block; }
        /* Switch stagione (stile On/Off) con lettere E (estate) / I (inverno) ai lati. */
        .wx-tuya-seasonsw { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; white-space: nowrap; }
        .wx-tuya-seasonlbl { font-size: 0.7rem; font-weight: 700; color: var(--text-dim); }
        .wx-tuya-seasonlbl.on { color: var(--text); }
        .wx-tuya-toggle:disabled { opacity: 0.6; cursor: default; }
        .wx-tuya-editname { cursor: pointer; }
        .wx-tuya-editname:hover { text-decoration: underline; }
        .wx-badge.on { color: #22c55e; }
        /* Righe KPI EasyFatt: etichetta · valore · variazione. */
        .wx-kpi-row { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.3rem 0; }
        .wx-kpi-label { flex: 1; min-width: 0; color: var(--text-dim); font-size: 0.74rem; }
        .wx-kpi-val { font-size: 0.95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
        .wx-kpi-delta { font-size: 0.72rem; font-weight: 700; color: var(--text-dim); }
        .wx-kpi-delta.up { color: #22c55e; }
        .wx-kpi-delta.down { color: #ef4444; }
        /* Widget To-do: checklist. */
        .wx-todo-body { gap: 0.1rem; }
        .wx-todo-row { display: flex; align-items: center; gap: 0.45rem; padding: 0.15rem 0; }
        .wx-todo-row input[type="checkbox"] { flex-shrink: 0; accent-color: #22c55e; cursor: pointer; }
        /* color esplicito (non ereditato): così segue --text del widget anche con
           sfondo personalizzato (l'ereditarietà porterebbe il colore del tema). */
        .wx-todo-text { flex: 1; min-width: 0; font-size: 0.82rem; outline: none; word-break: break-word; color: var(--text); }
        .wx-todo-row.done .wx-todo-text { text-decoration: line-through; color: var(--text-dim); }
        .wx-todo-due {
            flex-shrink: 0; background: none; border: none; color: var(--text-dim);
            font: inherit; font-size: 0.68rem; cursor: pointer; color-scheme: var(--cs, dark);
        }
        .wx-todo-row.overdue .wx-todo-due { color: #ef4444; }
        .wx-todo-bang { flex-shrink: 0; color: #ef4444; font-weight: 800; font-size: 0.9rem; }
        /* Tab Scadenze fiscali. */
        .wx-fisc-row { display: flex; gap: 0.5rem; padding: 0.2rem 0; font-size: 0.78rem; border-bottom: 1px solid var(--divider); }
        .wx-fisc-date { flex-shrink: 0; min-width: 2.8rem; font-variant-numeric: tabular-nums; color: var(--text-dim); font-weight: 600; }
        .wx-fisc-lbl { flex: 1; min-width: 0; color: var(--text); }
        .wx-fisc-row.past { opacity: 0.45; }
        .wx-fisc-row.next { font-weight: 700; }
        .wx-fisc-row.next .wx-fisc-date { color: #22c55e; }
        .wx-fisc-note { color: var(--text-dim); font-size: 0.66rem; opacity: 0.8; margin-top: 0.4rem; }
        .wx-fisc-toggle {
            background: none; border: none; color: var(--text-dim); cursor: pointer;
            font: inherit; font-size: 0.72rem; font-weight: 600; padding: 0.2rem 0; text-align: left; width: 100%;
        }
        .wx-fisc-toggle:hover { color: var(--text); }
        .wx-todo-del {
            flex-shrink: 0; background: none; border: none; color: var(--text-dim);
            cursor: pointer; font-size: 0.75rem; padding: 0 0.2rem; opacity: 0; transition: opacity .15s;
        }
        .wx-todo-row:hover .wx-todo-del { opacity: 1; }
        .wx-todo-del:hover { color: #ef4444; }
        .wx-todo-add {
            margin-top: 0.2rem; background: none; border: none; border-top: 1px solid var(--glass-border);
            color: var(--text); font: inherit; font-size: 0.82rem; padding: 0.3rem 0; width: 100%; outline: none;
        }
        .wx-todo-add::placeholder { color: var(--text-dim); }
        /* Linguette (tab canonici) come in Gestione: sottolineatura sull'attiva. */
        .wx-tabs { display: flex; gap: 0.2rem; margin-bottom: 0.5rem; border-bottom: 1px solid var(--glass-border); }
        .wx-tab {
            background: transparent; border: none;
            border-bottom: 2px solid transparent;
            border-radius: var(--radius-sm) var(--radius-sm) 0 0;
            padding: 0.4rem 0.8rem; margin-bottom: -1px;
            color: var(--text-dim); font-family: inherit; font-size: 0.74rem;
            font-weight: 600; cursor: pointer; transition: color .15s, border-color .15s, background .15s;
        }
        .wx-tab:hover { color: var(--text); background: var(--tab-hover-bg); }
        .wx-tab.active { color: var(--text); border-bottom-color: #22c55e; background: var(--tab-active-bg); }
        .wx-fc-row {
            display: flex; align-items: center; gap: 0.6rem;
            padding: 0.22rem 0; font-size: 0.85rem;
        }
        .wx-fc-day { flex: 1; text-transform: capitalize; }
        .wx-fc-ic { font-size: 1rem; }
        .wx-fc-temp { font-variant-numeric: tabular-nums; color: var(--text-dim); }
        .wx-notes { height: 100%; display: flex; flex-direction: column; }
        .wx-notes-tb { display: flex; gap: 0.25rem; margin-bottom: 0.4rem; flex-wrap: wrap; }
        .wx-nbtn {
            min-width: 1.6rem; height: 1.6rem; padding: 0 0.35rem;
            background: var(--btn); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text);
            font-family: inherit; font-size: 0.78rem; cursor: pointer;
        }
        .wx-nbtn:hover { background: var(--btn-hover); }
        /* Attivo: colori invertiti, fissi così restano leggibili anche quando il
           widget ha uno sfondo personalizzato (che sovrascrive --text). */
        .wx-nbtn.active { background: #e6eaf2; color: #161a22; border-color: #e6eaf2; }
        .wx-nbtn.b { font-weight: 800; }
        .wx-nbtn.i { font-style: italic; }
        .wx-nbtn.u { text-decoration: underline; }
        .wx-notes-area {
            flex: 1; min-height: 60px; overflow: auto;
            background: transparent; border: none; outline: none;
            color: var(--text); font-family: inherit; font-size: 0.88rem; line-height: 1.4;
        }
        /* Placeholder per l'editor vuoto (contenteditable). */
        .wx-notes-area:empty::before {
            content: attr(data-placeholder);
            color: var(--text-dim);
        }
        /* Elementi normalmente fixed/decorativi: dentro un widget tornano in flusso.
           Va annullato anche transform/left/top/bottom del posizionamento fixed,
           altrimenti la barra resta traslata (decentrata). */
        .widget-body .search-form,
        .widget-body .ticker-bar {
            position: static;
            z-index: auto;   /* la search-form ha z-index:100: coprirebbe l'header */
            width: 100%;
            margin: 0;
            transform: none;
            left: auto;
            right: auto;
            top: auto;
            bottom: auto;
        }
        /* Dentro il widget la barra news/ricerca è trasparente (usa lo sfondo del
           widget). */
        .widget-body .ticker-bar {
            background: transparent;
            backdrop-filter: none;
            border-top: none;
        }
        .widget-body .search-form,
        .widget-body .search-form:focus-within {
            background: transparent;
            backdrop-filter: none;
            border: none;
        }
        .widget-body .clock,
        .widget-body .weather-wrapper,
        .widget-body .greeting { margin: 0; }
        .widget-body .clock,
        .widget-body .greeting { text-align: center; }
        /* Widget "semplici": contenuto centrato verticalmente nella loro area. */
        .widget[data-type="logo"] > .widget-body,
        .widget[data-type="clock"] > .widget-body,
        .widget[data-type="search"] > .widget-body,
        .widget[data-type="ansa"] > .widget-body {
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        /* Widget orologio = saluto + orario: un po' di spazio tra le due parti. */
        .widget[data-type="clock"] > .widget-body { gap: 0.4rem; }

        /* --- Intestazione widget (solo in modalità modifica) --- */
        /* In editazione l'header è sovrapposto (assoluto): non occupa spazio nel
           flusso, così il contenuto non si sposta verso il basso rispetto alla
           vista normale. Semitrasparente (50%) sopra il contenuto. */
        .widget-head {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            z-index: 20;
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.15rem 0.7rem;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(4px);
            color: #fff;
            /* Segue i bordi arrotondati del widget (i collassabili hanno overflow
               visibile, quindi la barra non viene ritagliata: la arrotondo io). */
            border-radius: var(--radius) var(--radius) 0 0;
            /* La barra non cattura il mouse: solo i suoi controlli. Così le maniglie
               di resize laterali restano afferrabili anche sotto la barra. */
            pointer-events: none;
        }
        .widget-head > * { pointer-events: auto; }
        .widget-head .widget-title { pointer-events: none; }   /* testo: lascia passare al resize */
        /* Font bianco dentro la barra di modifica (titolo, handle, controlli). */
        .widget-head .widget-title,
        .widget-head .widget-handle,
        .widget-head .widget-opt:not(.active),
        .widget-head .widget-chev,
        .widget-head .widget-rm { color: #fff; }
        /* Barra titolo "in vista" (solo widget collassabili): in flusso, cliccabile. */
        .widget-head--flow {
            position: static;
            background: transparent;
            backdrop-filter: none;
            border-bottom: 1px solid var(--glass-border);
            cursor: pointer;
            padding: 0.3rem 0.6rem;
        }
        .widget-handle { cursor: grab; color: var(--text-dim); font-size: 0.9rem; }
        .widget-title {
            flex: 1;
            min-width: 0;
            font-size: 0.7rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            color: var(--text-dim);
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        /* Pulsantini header: opzioni (lettera), chevron, rimozione. */
        .widget-opt, .widget-chev, .widget-rm {
            flex-shrink: 0;
            background: none;
            border: none;
            color: var(--text-dim);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.72rem;
            font-weight: 700;
            line-height: 1;
            padding: 0.12rem 0.28rem;
            border-radius: var(--radius-sm);
        }
        .widget-opt:hover, .widget-chev:hover, .widget-rm:hover { background: var(--card-hover); color: var(--text); }
        /* Swatch colore di sfondo nell'header. */
        .widget-color {
            flex-shrink: 0;
            width: 18px; height: 18px;
            padding: 0; border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); background: none; cursor: pointer;
        }
        .widget-color::-webkit-color-swatch-wrapper { padding: 0; }
        .widget-color::-webkit-color-swatch { border: none; border-radius: 3px; }
        /* Pallino colore + pannellino (selettore + ripristina default). */
        .widget-color-wrap { position: relative; display: inline-flex; }
        .widget-color-btn { font-size: 0.9rem; line-height: 1; }
        .widget-color-pop {
            position: absolute; top: calc(100% + 6px); right: 0;
            display: none; flex-direction: column; gap: 0.4rem; align-items: stretch;
            background: var(--bg-to); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); padding: 0.5rem;
            z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        }
        .widget-color-wrap:focus-within .widget-color-pop { display: flex; }
        .widget-color-pop .widget-color { width: 100%; height: 28px; }
        .widget-color-default {
            background: var(--btn); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); color: var(--text);
            font: inherit; font-size: 0.74rem; font-weight: 600;
            padding: 0.3rem 0.5rem; cursor: pointer; white-space: nowrap;
        }
        .widget-color-default:hover:not(:disabled) { background: var(--btn-hover); }
        .widget-color-default:disabled { opacity: 0.45; cursor: default; }
        .widget-opt.active { color: #22c55e; }
        .widget-rm:hover { color: #ef4444; }
        /* Controlli span (larghezza in colonne) e numero colonne. */
        .widget-span-btn {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            color: var(--text);
            cursor: pointer;
            font-family: inherit;
            font-size: 0.8rem;
            line-height: 1;
            width: 1.4rem;
            height: 1.4rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transition: background .15s;
        }
        .widget-span-btn:hover:not(:disabled) { background: var(--btn-hover); }
        .widget-span-btn:disabled { opacity: 0.4; cursor: default; }
        .widget-span-lbl {
            font-size: 0.7rem;
            font-variant-numeric: tabular-nums;
            color: var(--text-dim);
            min-width: 1.8rem;
            text-align: center;
        }
        .widget-cols-ctl { display: inline-flex; align-items: center; gap: 0.35rem; margin-right: 0.4rem; }

        /* Le celle vuote di scorta (vedi GRID_SPARE_ROWS) fanno già da zona di
           rilascio sotto l'ultima riga; basta un piccolo margine extra. */
        .widget-grid.editing { padding-bottom: 1.2rem; }
        /* In modifica non forziamo sfondo/bordo: l'anteprima di sfondo/bordo è dal
           vivo. Per la presa, solo i widget SENZA bordo ricevono un contorno
           tratteggiato leggero (così il toggle bordo resta percepibile). */
        .widget-grid.editing .widget { cursor: move; }
        .widget-grid.editing .widget.widget-noborder {
            border: 1px dashed var(--glass-border);
        }
        .widget.dragging { opacity: 0.45; }
        .widget.drag-hide { display: none; }
        /* Riquadro di destinazione del drag: verde = ci sta, rosso = occupato/fuori. */
        .widget-placeholder {
            border: 2px dashed #22c55e;
            border-radius: var(--radius);
            background: rgba(34, 197, 94, 0.12);
            pointer-events: none;
        }
        .widget-placeholder.bad {
            border-color: #ef4444;
            background: rgba(239, 68, 68, 0.12);
        }
        /* Maniglie di ridimensionamento (trascina i bordi). */
        /* z-index 25 = sopra l'header (z 20): così i lati nord/ovest sono afferrabili.
           Spessore 9px: i pulsanti dell'header sono rientrati (~11px) e non vengono coperti. */
        .widget-resize { position: absolute; z-index: 25; }
        .widget-resize.e { top: 0; right: 0; width: 9px; height: 100%; cursor: ew-resize; }
        .widget-resize.w { top: 0; left: 0; width: 9px; height: 100%; cursor: ew-resize; }
        .widget-resize.s { left: 0; bottom: 0; height: 9px; width: 100%; cursor: ns-resize; }
        .widget-resize.n { left: 0; top: 0; height: 9px; width: 100%; cursor: ns-resize; }
        /* Angoli 18×18, tutti sopra l'header: con l'header rientrato di 9px e i
           pulsanti a ~20px dal bordo, i 18px d'angolo non li coprono. */
        .widget-resize.se, .widget-resize.sw, .widget-resize.ne, .widget-resize.nw { width: 18px; height: 18px; }
        .widget-resize.se { right: 0; bottom: 0; cursor: nwse-resize; z-index: 26; }
        .widget-resize.sw { left: 0; bottom: 0; cursor: nesw-resize; z-index: 26; }
        .widget-resize.ne { right: 0; top: 0; cursor: nesw-resize; z-index: 26; }
        .widget-resize.nw { left: 0; top: 0; cursor: nwse-resize; z-index: 26; }
        /* Affordance: evidenzia la zona di presa al passaggio del mouse (in modifica). */
        body.widget-editing .widget-resize:hover { background: rgba(34, 197, 94, 0.25); }
        body.widget-resizing { user-select: none; cursor: nwse-resize; }

        /* --- Palette (controlli dentro la topbar in personalizzazione) --- */
        .widget-palette {
            display: flex;
            flex-wrap: nowrap;
            align-items: center;
            gap: 0.7rem;
            flex: 1 1 auto;
            min-width: 0;
            text-align: left;
        }
        .wp-sep { flex: 0 0 1px; align-self: stretch; background: var(--glass-border); margin: 0.1rem 0.1rem; }
        .wp-group { display: flex; align-items: center; gap: 0.8rem; flex-shrink: 0; }
        .wp-lab {
            font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em;
            text-transform: uppercase; color: var(--text-dim); flex-shrink: 0;
        }
        .wp-slider { display: flex; align-items: center; gap: 0.4rem; }
        .wp-val {
            font-size: 0.72rem; font-variant-numeric: tabular-nums;
            color: var(--text); min-width: 2.6rem;
        }
        .wp-slider input[type="range"] {
            width: 5.5rem; height: 4px; cursor: pointer;
            accent-color: #22c55e; background: transparent;
        }
        /* Toggle "Adatta a schermo": switch come il selettore tema. */
        .wp-switch {
            display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0;
            background: var(--btn); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); padding: 0.3rem 0.7rem;
            color: var(--text-dim); font: inherit; font-size: 0.74rem; font-weight: 600;
            cursor: pointer; white-space: nowrap;
        }
        .wp-switch.on { color: var(--text); }
        .wp-switch-track {
            position: relative; width: 26px; height: 14px; border-radius: 7px;
            background: var(--glass-border); transition: background .2s; flex-shrink: 0;
        }
        .wp-switch-track::after {
            content: ''; position: absolute; top: 1px; left: 1px;
            width: 12px; height: 12px; border-radius: 50%; background: #fff;
            transition: transform .2s;
        }
        .wp-switch.on .wp-switch-track { background: #22c55e; }
        .wp-switch.on .wp-switch-track::after { transform: translateX(12px); }
        /* Gruppo "Aggiungi": un solo pulsante con menu a tendina (niente più
           scroll orizzontale). Riempie lo spazio così le azioni restano a destra. */
        .wp-add { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
        .wp-add-menu {
            position: absolute; top: calc(100% + 6px); left: 0;
            display: none; flex-direction: column; gap: 0.1rem;
            min-width: 12rem; max-height: 60vh; overflow-y: auto;
            background: var(--bg-to); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); padding: 0.3rem;
            z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        }
        .wp-add:focus-within .wp-add-menu { display: flex; }
        .wp-add-item {
            text-align: left; background: transparent; border: none; border-radius: 6px;
            color: var(--text); font: inherit; font-size: 0.78rem; font-weight: 600;
            padding: 0.4rem 0.6rem; cursor: pointer; white-space: nowrap;
        }
        .wp-add-item:hover { background: var(--btn-hover); }
        .wp-empty { font-size: 0.72rem; color: var(--text-dim); }
        /* Gruppo "Impostazioni": stesso menu a tendina di "Aggiungi", ma in colonna
           con gli slider e lo switch (apertura via :focus-within). */
        .wp-settings { position: relative; display: flex; align-items: center; flex-shrink: 0; }
        .wp-settings-menu {
            position: absolute; top: calc(100% + 6px); left: 0;
            display: none; flex-direction: column; gap: 0.7rem;
            min-width: 14rem;
            background: var(--bg-to); border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm); padding: 0.8rem;
            z-index: 200; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
        }
        .wp-settings:focus-within .wp-settings-menu { display: flex; }
        .wp-settings-menu .wp-slider { justify-content: space-between; }
        .wp-settings-menu .wp-slider input[type="range"] { width: 7rem; }
        .wp-actions { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
        .widget-add, .widget-done, .widget-classic {
            background: var(--btn);
            border: 1px solid var(--glass-border);
            border-radius: var(--radius-sm);
            padding: 0.3rem 0.7rem;
            color: var(--text);
            font-family: inherit;
            font-size: 0.74rem;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            flex-shrink: 0;
            transition: background .15s;
        }
        .widget-add:hover, .widget-done:hover, .widget-classic:hover { background: var(--btn-hover); }
        .widget-done { color: #22c55e; }
        .widget-classic { color: var(--text-dim); }
        /* Toggle "Adatta a schermo" attivo. */
        .widget-classic.wp-on {
            color: #fff;
            background: #22c55e;
            border-color: #22c55e;
        }

        @media (max-width: 900px) {
            /* Sotto i 900px si torna alla colonna unica: i widget si impilano
               (!important per vincere su grid-template/placement impostati inline). */
            .widget-grid { grid-template-columns: 1fr !important; }
            .widget { grid-column: 1 / -1 !important; grid-row: auto !important; }
            .widget-cell { display: none !important; }
        }

