/* (c) 2026 Ciegi Soft di Cavallaro Gaetano - P.IVA 04544040159 - www.ciegisoft.com - tutti i diritti riservati.
 * App agenti del Gestionale CiegiSoft, in licenza d'uso: vietati copia, modifica e distribuzione senza autorizzazione
 * scritta di Ciegi Soft. Condizioni in LICENZA.txt. */
/* ArtecaVisite — stile base
 * Palette: Arteca blu (#1f3b73) + grigi.
 * Mobile-first, PWA installabile.
 */

:root {
    --col-primary: #1f3b73;
    --col-primary-dark: #152a52;
    --col-primary-light: #2e5aa8;
    --col-bg: #f9fafb;
    --col-surface: #ffffff;
    --col-border: #e5e7eb;
    --col-text: #1f2937;
    --col-text-muted: #6b7280;
    --col-ok: #16a34a;
    --col-warn: #f59e0b;
    --col-err: #dc2626;
    --col-info-bg: #dbeafe;
    --radius: 8px;
    --shadow: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    color: var(--col-text);
    background: var(--col-bg);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* HEADER */
#app-header {
    background: var(--col-primary);
    color: #fff;
    box-shadow: var(--shadow-md);
    position: sticky; top: 0; z-index: 10;
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; max-width: 900px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 0.5rem; }
.logo-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 6px;
    background: #fff; color: var(--col-primary);
    font-weight: 800; font-size: 0.85rem; letter-spacing: -0.5px;
}
.header-right { display: flex; align-items: center; gap: 0.75rem; }

/* Pallino sync (CSS, mai emoji) — standard CiegiSoft */
.sync-dot {
    display: inline-block;
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--col-text-muted);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
}
.sync-dot.sync-ok   { background: var(--col-ok); }
.sync-dot.sync-wait { background: var(--col-warn); }
.sync-dot.sync-err  { background: var(--col-err); }
.sync-dot.sync-off  { background: #9ca3af; }

.icon-btn {
    background: transparent; border: 0; color: #fff;
    padding: 0.5rem; border-radius: 4px;
    cursor: pointer; font-size: 1.25rem;
}
.icon-btn:hover { background: rgba(255,255,255,0.15); }

/* BANNER */
.banner {
    padding: 0.75rem 1rem;
    display: flex; align-items: center; justify-content: center;
    gap: 0.75rem; flex-wrap: wrap;
    font-size: 0.9rem;
}
.banner-info { background: var(--col-info-bg); color: var(--col-primary-dark); }

/* MAIN */
#app-main {
    flex: 1;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1rem;
}
.page { background: var(--col-surface); border-radius: var(--radius);
        padding: 1.5rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
/* 1.56.2: meno spazio tra la pagina e il piede */
#app-main { padding-bottom: .25rem; }
#app-main > .page:last-child { margin-bottom: .25rem; }
/* 1.56.3 (Gae): niente spazio vuoto sotto la home, il piede con il marchio sale */
.page-home { padding-bottom: .5rem !important; }
.page-home #home-agente { margin: .4rem 0 0; }
.page-home .actions { margin-top: .6rem; }
.page h1 { margin-top: 0; color: var(--col-primary); font-size: 1.4rem; }
.page-login { max-width: 420px; margin: 1rem auto; }

/* LOADING */
.centered { text-align: center; padding: 3rem 1rem; color: var(--col-text-muted); }
.spinner {
    display: inline-block; width: 32px; height: 32px;
    border: 3px solid #e5e7eb; border-top-color: var(--col-primary);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* FORM */
label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; color: var(--col-text); }
input[type="text"], input[type="password"], input[type="email"], input[type="search"],
input[type="number"], input[type="date"], input[type="time"], input[type="tel"],
input[type="datetime-local"], select, textarea {
    display: block; width: 100%;
    padding: 0.65rem 0.75rem; margin-top: 0.3rem;
    border: 1px solid var(--col-border); border-radius: var(--radius);
    font-size: 1rem; font-family: inherit;
    background: #fff; color: var(--col-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--col-primary);
    box-shadow: 0 0 0 3px rgba(31,59,115,0.15);
}
textarea { min-height: 100px; resize: vertical; }

label.checkbox {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 400;
}
label.checkbox input { width: auto; margin: 0; }

/* BOTTONI */
.btn {
    display: inline-block;
    padding: 0.65rem 1.25rem;
    border: 1px solid var(--col-border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--col-text);
    font-size: 0.95rem; font-weight: 500;
    cursor: pointer;
    text-align: center; text-decoration: none;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--col-primary); color: #fff; border-color: var(--col-primary); }
.btn-primary:hover { background: var(--col-primary-dark); }
.btn-danger { background: var(--col-err); color: #fff; border-color: var(--col-err); }
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; margin-top: 1rem; }

/* ERRORI */
.err {
    background: #fee2e2;
    color: var(--col-err);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--col-err);
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.hint { display: block; margin-top: 0.3rem; font-size: 0.8rem; font-weight: 400; color: var(--col-text-muted); }

/* NOTES */
.note {
    font-size: 0.85rem; color: var(--col-text-muted);
    margin-top: 1rem; line-height: 1.5;
}

/* UTIL */
.row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* DISPOSITIVI */
.device-item {
    border: 1px solid var(--col-border);
    border-radius: var(--radius);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fff;
    display: flex; justify-content: space-between; align-items: center;
}
.device-item.corrente { border-color: var(--col-primary); background: #eff6ff; }
.device-info { font-size: 0.9rem; }
.device-info strong { display: block; margin-bottom: 2px; }
.device-info small { color: var(--col-text-muted); }

/* FOOTER */
#app-footer {
    text-align: center;
    color: var(--col-text-muted);
    padding: .15rem .75rem .35rem;        /* 1.56.2: piu' stretto, su una riga sola */
    font-size: 0.8rem;                    /* 1.56.4 (Gae): come il portale, piu' leggibile e piu' marcato */
    font-weight: 500;
    color: #475569;
    line-height: 1.3;
}
#app-footer .piede-ciegi { margin-top: 0; }
#app-footer .ciegi-logo { height: 1.7em; }

/* INPUT VOCALE: bottone microfono */
.btn-mic {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--col-primary-light);
    color: #fff;
    border: 0;
    cursor: pointer;
    margin-left: 0.5rem;
    vertical-align: middle;
}
.btn-mic.recording { background: var(--col-err); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.1); } }

/* MOBILE */
@media (max-width: 480px) {
    .page { padding: 1rem; }
    .btn-block { font-size: 1rem; }
}

/* LINK come bottone (registrati / torna all'accesso) */
.link-row { text-align: center; margin-top: 1.25rem; font-size: 0.9rem; color: var(--col-text-muted); }
.link-btn {
    background: none; border: 0; padding: 0; font: inherit;
    color: var(--col-primary); font-weight: 600; text-decoration: underline; cursor: pointer;
}
.ok-box {
    background: #dcfce7; border-left: 3px solid var(--col-ok);
    padding: 0.75rem 1rem; border-radius: var(--radius); margin-top: 1rem;
}
.ok-box p { margin: 0.4rem 0 0; font-size: 0.9rem; }

/* BADGE (numero richieste in attesa) */
.badge {
    display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px;
    border-radius: 10px; background: var(--col-err); color: #fff;
    font-size: 0.75rem; font-weight: 700; line-height: 20px; text-align: center;
}

/* GESTIONE UTENTI */
h2.sez { font-size: 1rem; color: var(--col-primary); margin: 1.5rem 0 0.5rem;
         border-bottom: 1px solid var(--col-border); padding-bottom: 0.3rem; }
.utente-item {
    border: 1px solid var(--col-border); border-radius: var(--radius);
    padding: 0.75rem; margin-bottom: 0.5rem; background: #fff;
}
.utente-item.stato-in_attesa { border-left: 4px solid var(--col-warn); background: #fffbeb; }
.utente-item.stato-disattivato { opacity: 0.7; }
.utente-info strong { display: block; }
.utente-info small { display: block; color: var(--col-text-muted); font-size: 0.85rem; }
.utente-azioni { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.6rem; }
.utente-campi { display: flex; gap: 0.5rem; flex: 1 1 100%; }
.utente-campi select, .utente-campi input { margin-top: 0; padding: 0.45rem 0.6rem; font-size: 0.9rem; }
.utente-campi input { max-width: 150px; }

/* ================= v1.1: visite, clienti, follow-up ================= */
.home-sync { font-size: 0.85rem; color: var(--col-text-muted); margin: -0.3rem 0 1rem; }
.home-sync.stato-err  { color: var(--col-err); font-weight: 600; }
.home-sync.stato-wait { color: #b45309; }
.home-sync.stato-ok   { color: var(--col-ok); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
    min-height: 96px; padding: 0.75rem; border: 1px solid var(--col-border); border-radius: 12px;
    background: #fff; color: var(--col-primary); font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer;
}
.tile:hover { background: #f3f6fb; }
.tile-ico { font-size: 1.6rem; line-height: 1; }
.tile-primaria { grid-column: 1 / -1; background: var(--col-primary); color: #fff; border-color: var(--col-primary); min-height: 80px; }
/* 1.56.2 (Gae): «Nuova visita» piu' bassa, con il + a sinistra */
/* 1.56.2: riquadri della home un po' piu' bassi, per vedere anche il piede con il marchio Ciegi Soft */
.page > .tiles { gap: .6rem; }
.page > .tiles .tile { min-height: 82px; padding: .55rem .6rem; gap: .25rem; }
.page > .tiles .tile-ico { font-size: 1.45rem; }
#tile-nuova { flex-direction: row; justify-content: center; gap: .6rem; min-height: 0; padding: .7rem 1.1rem; font-size: 1.05rem; }
.tile-primaria:hover { background: var(--col-primary-dark); }
.tile-primaria .tile-ico { font-size: 2rem; }

.campo { margin-bottom: 1rem; }
.campo-lbl { display: block; font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; }
.cliente-scelto {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    border: 1px solid var(--col-primary); background: #eff6ff; border-radius: var(--radius); padding: 0.6rem 0.75rem;
}
.cliente-scelto strong { display: block; }
.cliente-scelto small { color: var(--col-text-muted); }
.risultati { margin-top: 0.4rem; }
.riga-cliente {
    display: block; width: 100%; text-align: left; font: inherit; cursor: pointer;
    background: #fff; border: 1px solid var(--col-border); border-radius: var(--radius);
    padding: 0.55rem 0.75rem; margin-bottom: 0.35rem; color: var(--col-text);
}
.riga-cliente:hover { background: #f3f6fb; }
.riga-cliente strong { display: block; font-size: 0.95rem; }
.riga-cliente small { color: var(--col-text-muted); font-size: 0.8rem; }
label.checkbox.piccolo { font-size: 0.85rem; margin: 0.4rem 0; }
.filtri-chk { display: flex; gap: 1rem; flex-wrap: wrap; }

.griglia-2, .griglia-3 { display: grid; gap: 0 0.75rem; }
.griglia-2 { grid-template-columns: 1fr 1fr; }
.griglia-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 420px) { .griglia-3 { grid-template-columns: 1fr 1fr; } }
textarea.corta { min-height: 60px; }

/* campo + bottone microfono affiancati */
.con-mic { display: flex; align-items: flex-start; gap: 0.4rem; }
.con-mic > input, .con-mic > textarea { flex: 1; }
.con-mic .btn-mic { margin: 0.3rem 0 0; flex: 0 0 auto; }

.card-visita, .card-fu {
    display: block; width: 100%; text-align: left; font: inherit; color: var(--col-text);
    background: #fff; border: 1px solid var(--col-border); border-radius: var(--radius);
    padding: 0.65rem 0.75rem; margin-bottom: 0.5rem; cursor: pointer;
}
.card-visita:hover { background: #f8fafc; }
.cv-riga1 { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; color: var(--col-text-muted); }
.cv-data { font-weight: 600; color: var(--col-text); }
.cv-cliente { font-weight: 600; margin-top: 0.2rem; }
.cv-note { font-size: 0.85rem; color: #374151; margin-top: 0.2rem; white-space: pre-line; }
.cv-stato { display: inline-block; margin-top: 0.35rem; font-size: 0.75rem; color: #b45309; background: #fef3c7; border-radius: 10px; padding: 0 8px; }
.cv-stato.errore { color: #fff; background: var(--col-err); }
.esito { font-size: 0.75rem; border-radius: 10px; padding: 0 8px; background: #e5e7eb; color: #374151; }
.esito-ordine { background: #dcfce7; color: #166534; }
.esito-preventivo { background: #dbeafe; color: #1e40af; }
.esito-interessato { background: #e0f2fe; color: #075985; }
.esito-ricontattare { background: #fef3c7; color: #92400e; }
.esito-non_interessato, .esito-assente { background: #f3f4f6; color: #6b7280; }

.card-fu { cursor: default; border-left-width: 4px; }
.fu-scaduto { border-left-color: var(--col-err); background: #fef2f2; }
.fu-oggi { border-left-color: var(--col-warn); background: #fffbeb; }
.fu-presto { border-left-color: var(--col-primary-light); }
.fu-dopo { border-left-color: var(--col-border); }
.fu-data { font-weight: 700; font-size: 0.85rem; }
.fu-testo { margin: 0.2rem 0; white-space: pre-line; }
.card-fu .actions { margin-top: 0.5rem; }
h2.sez-scaduto { color: var(--col-err); }

.cli-dati { margin: 0.5rem 0 1rem; }
.cli-riga { display: flex; gap: 0.75rem; padding: 0.35rem 0; border-bottom: 1px solid #f1f5f9; font-size: 0.92rem; }
.cli-lbl { flex: 0 0 90px; color: var(--col-text-muted); }
.cli-riga a { color: var(--col-primary); overflow-wrap: anywhere; }

.chiave-box { background: #fffbeb; border: 1px solid var(--col-warn); border-radius: var(--radius); padding: 0.75rem; margin: 0.5rem 0; }
.chiave { display: block; word-break: break-all; background: #fff; padding: 0.5rem; border-radius: 4px; margin: 0.4rem 0; font-size: 0.85rem; }
#import-stato div { margin-bottom: 0.2rem; }

.row-between { gap: 0.5rem; align-items: flex-start; }
.row-between h1 { flex: 1; min-width: 0; }
.row-between .btn, .row-between > div { white-space: nowrap; flex: 0 0 auto; }
.griglia-2.filtri { grid-template-columns: minmax(150px, auto) 1fr; }

/* v1.2: visite di tutti */
.cv-autore { font-size: 0.8rem; color: var(--col-primary-light); font-weight: 600; margin-top: 0.15rem; }
.banner-lettura { background: #eef2ff; border-left: 3px solid var(--col-primary-light); color: var(--col-primary-dark);
                  padding: 0.6rem 0.75rem; border-radius: var(--radius); font-weight: 600; }
label.filtro-chi { margin-bottom: 0.5rem; }
form#form-visita :disabled { background: #f9fafb; color: var(--col-text); opacity: 1; }

/* versione in alto accanto al nome */
.ver-testa { font-size: 0.75rem; font-weight: 500; opacity: 0.8; margin-left: 0.15rem; align-self: flex-end; padding-bottom: 2px; }

/* ---- Importazione storico (1.3.0) */
.st-lbl { flex-basis: 110px; }
.st-forte { font-weight: 700; color: var(--col-primary-dark); }
.st-avviso { color: #b45309; }
.st-testa-righe { margin: 1.25rem 0 0.5rem; align-items: center; }
.st-testa-righe h2 { margin: 0; }
.st-testa-righe select { width: auto; max-width: 55%; }
.st-card { cursor: default; border-left-width: 4px; }
.st-da_decidere { border-left-color: var(--col-warn); }
.st-confermata { border-left-color: var(--col-primary-light); }
.st-importata { border-left-color: #16a34a; background: #f8fdf9; }
.st-escluso { border-left-color: var(--col-border); background: #f8fafc; }
.st-note { max-height: 7.5em; overflow: auto; }
.st-lbl-prop { font-size: 0.8rem; color: var(--col-text-muted); margin: 0.5rem 0 0.25rem; }
.st-scelto { margin-top: 0.4rem; padding: 0.4rem 0.6rem; background: #eef2ff; border-radius: 6px; }
.st-scelto strong { display: block; font-size: 0.92rem; }
.st-scelto small { color: var(--col-text-muted); font-size: 0.8rem; }
.st-cerca { margin-top: 0.6rem; }
.st-badge-da_decidere { background: #fef3c7; color: #92400e; }
.st-badge-confermata { background: #dbeafe; color: #1e40af; }
.st-badge-importata { background: #dcfce7; color: #166534; }
.st-aff-alta { background: #dcfce7; color: #166534; font-weight: 500; }
.st-aff-media { background: #fef3c7; color: #92400e; font-weight: 500; }
.st-aff-bassa { background: #f3f4f6; color: #6b7280; font-weight: 500; }

/* ---- Ricerca clienti per campo (1.4.0) */
.ricerca { margin-bottom: 0.25rem; }
.ricerca-riga { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.35rem; }
.ricerca-riga > .con-mic { flex: 1 1 auto; min-width: 0; display: flex; }
.ricerca-riga > .con-mic input { flex: 1 1 auto; min-width: 0; margin: 0; }
.ricerca-campo { flex: 0 0 auto; width: auto; max-width: 38%; margin: 0; }
.btn-x { flex: 0 0 auto; background: none; border: 1px solid var(--col-border); border-radius: var(--radius);
         color: var(--col-text-muted); font: inherit; padding: 0.35rem 0.6rem; cursor: pointer; }
.ricerca-piu { font-size: 0.85rem; margin-right: 0.75rem; }
.ricerca .hint { display: inline; }
.aiuto-voce { margin-top: 0.2rem; }

/* ---- Menu utente in alto (1.4.1) */
.account { position: relative; }
.account-btn { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.25); color: #fff;
               font: inherit; font-size: 0.85rem; padding: 0.3rem 0.6rem; border-radius: 999px; cursor: pointer;
               max-width: 40vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-btn:hover { background: rgba(255,255,255,0.22); }
.menu-account { position: absolute; right: 0; top: calc(100% + 6px); z-index: 50; min-width: 220px;
                background: #fff; border: 1px solid var(--col-border); border-radius: var(--radius);
                box-shadow: 0 8px 24px rgba(0,0,0,0.15); padding: 0.3rem 0; }
.menu-account button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit;
                       font-size: 0.95rem; color: var(--col-text); padding: 0.65rem 1rem; cursor: pointer; }
.menu-account button:hover { background: #f3f6fb; }
.menu-account button:disabled { color: #9ca3af; cursor: default; background: none; }
.menu-account .menu-esci { color: var(--col-err); border-top: 1px solid var(--col-border); margin-top: 0.2rem; }

/* ---- Visibilita' visite per utente (1.5.0) */
.utente-campi { flex-wrap: wrap; }
.utente-campi .utente-tutte { flex: 1 1 100%; margin: 0.2rem 0 0; }
.utente-campi .utente-tutte input { max-width: none; width: auto; }

/* ---- Clienti potenziali e trasferimento visite (1.6.0) */
.btn-nuovo-pot { margin-bottom: 0.75rem; }
.cli-azioni { margin-top: 0.75rem; }
#form-potenziale .griglia-3 { grid-template-columns: 1fr 2fr 0.8fr; }
#tr-conferma { margin-top: 1rem; }
#tr-conferma p { margin: 0.5rem 0; }

/* ---- Navigazione: Indietro + Home in ogni pannello (1.6.2) */
.nav-btns { display: flex; gap: 0.35rem; flex: 0 0 auto; }
.nav-btns .btn { white-space: nowrap; }
/* 1.110.0: «🔄 Aggiorna» nelle pagine di consultazione; sul telefono solo il simbolo */
.btn-aggiorna .agg-ico { display: inline-block; }
.btn-aggiorna.in-corso .agg-ico { animation: agg-giro 1s linear infinite; }
@keyframes agg-giro { to { transform: rotate(360deg); } }
@media (max-width: 600px) { .btn-aggiorna .nav-txt { display: none; } }
@media print { .btn-aggiorna { display: none !important; } }
.row-between h1 { min-width: 0; overflow-wrap: break-word; }
@keyframes nav-lampo { 0% { box-shadow: 0 0 0 3px var(--col-primary-light); } 100% { box-shadow: 0 0 0 0 transparent; } }
.nav-ultimo { animation: nav-lampo 1.6s ease-out; background: #eef2ff !important; }

/* ---- Utenti creati dall'amministratore (1.7.0) */
#form-nuovo-utente { margin: 0.75rem 0 1rem; }
#form-nuovo-utente h2 { margin-top: 0; }
.riga-pwd { display: flex; gap: 0.4rem; align-items: center; }
.riga-pwd input { flex: 1 1 auto; margin-top: 0.3rem; font-family: ui-monospace, Consolas, monospace; }
.cred-testo { white-space: pre-wrap; word-break: break-word; background: #fff; border: 1px solid var(--col-border);
              border-radius: 6px; padding: 0.6rem; font-size: 0.85rem; margin: 0.5rem 0; }
#cred-wa { background: #25D366; border-color: #25D366; text-decoration: none; }

/* ---- Storico: rimanenti tutte insieme (1.7.3) */
#st-massivo { margin: 1rem 0; }
.st-gruppo { font-weight: 600; margin: 0.9rem 0 0.3rem; }
.st-voci { max-height: 50vh; overflow: auto; border: 1px solid var(--col-border); border-radius: 6px; background: #fff; padding: 0.25rem 0.5rem; }
.st-voce { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.85rem; font-weight: 400; padding: 0.35rem 0; margin: 0;
           border-bottom: 1px solid #f1f5f9; }
.st-voce input[type=checkbox] { margin-top: 0.2rem; flex: 0 0 auto; }
.st-voce-pot { flex-wrap: wrap; align-items: center; }
.st-voce-pot input[type=text] { flex: 1 1 60%; margin: 0; padding: 0.35rem 0.5rem; font-size: 0.85rem; }
.st-voce-pot small { flex: 1 1 100%; color: var(--col-text-muted); padding-left: 1.6rem; }

/* ---- Esposizione finanziaria nella scheda cliente (1.7.4) */
.cli-esp { margin: 0 0 1rem; }
.esp-tab { border: 1px solid var(--col-border); border-radius: 6px; overflow: hidden; background: #fff; }
.esp-riga { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0.7rem; border-bottom: 1px solid #f1f5f9; font-size: 0.92rem; }
.esp-riga:last-child { border-bottom: 0; }
.esp-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.esp-tot { font-weight: 700; background: #f8fafc; }
.esp-debito { color: var(--col-err); }
.esp-credito { color: var(--col-ok); }
.cli-esp .note { display: block; margin-top: 0.3rem; }

/* 1.7.5 — contatori nei pannelli */
.conta { margin: .4rem 0 .6rem; font-size: .92rem; font-weight: 600; color: var(--col-text); }
/* scheda cliente: pulsanti in alto a destra, ragione sociale a tutta larghezza sotto (niente parole spezzate) */
.row-titolo-lungo { flex-wrap: wrap; }
.row-titolo-lungo .nav-btns { order: 1; margin-left: auto; }
.row-titolo-lungo h1 { order: 2; flex: 1 1 100%; margin-top: .4rem; }
/* 1.7.6 — bottone WhatsApp sugli utenti */
.btn-wa { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn-wa:hover { background: #178c46; border-color: #178c46; }

/* 1.8.0 — magazzino */
.disp-ordine { color: var(--col-text-muted); }
.cli-pulsanti { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.cli-pulsanti .btn { width: 100%; }
#mag-cat { max-width: 100%; margin-right: .5rem; }
.riga-art { display: flex; justify-content: space-between; align-items: center; gap: .75rem; text-align: left; }
.art-sx { min-width: 0; }
.art-dx { text-align: right; white-space: nowrap; }
.art-dx small { display: block; }
.art-disp { font-weight: 700; font-variant-numeric: tabular-nums; }
.disp-si { color: var(--col-ok); }
.disp-no { color: var(--col-err); }
.art-numeri { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .5rem 0 .2rem; }
.art-num { border: 1px solid var(--col-border); border-radius: 6px; background: #fff; padding: .45rem .3rem; text-align: center; }
.art-num-lbl { display: block; font-size: .72rem; color: var(--col-text-muted); }
.art-num-val { display: block; font-weight: 700; font-variant-numeric: tabular-nums; font-size: .95rem; overflow-wrap: anywhere; }
.art-num.disp-si .art-num-val { color: var(--col-ok); }
.art-num.disp-no .art-num-val { color: var(--col-err); }
.art-flag { color: #b45309; font-size: .78rem; }
@media (max-width: 380px) { .art-numeri { grid-template-columns: repeat(2, 1fr); } }

/* 1.8.1 — ordini clienti */
.ord-cliente { font-weight: 600; margin: .2rem 0 .6rem; }
/* 1.95.2: il cliente si tocca e apre la scheda */
a.cli-link { color: var(--col-primary); text-decoration: none; font-weight: 600; }
a.cli-link:hover, a.cli-link:focus-visible { text-decoration: underline; }
.cli-link-vai { font-weight: 400; font-size: .85em; opacity: .85; }
a.cli-debito { display: inline-block; margin-left: .25rem; padding: 0 .4rem; border-radius: 999px; background: #fdecec; color: #b42318; font-size: .82em; font-weight: 700; text-decoration: none; }
#ord-filtro { margin-bottom: .2rem; }
.ord-r1 { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.ord-r1 strong { min-width: 0; }
.st-badge { flex: none; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.st-aperto { background: #fee2e2; color: #b91c1c; }
.st-parziale { background: #fef3c7; color: #b45309; }
.st-evaso { background: #dcfce7; color: #15803d; }
.ordn-testa { margin: .2rem 0 .4rem; }
.ordn-tot { font-weight: 700; margin-top: .3rem; }
.ordn-qta { display: flex; flex-wrap: wrap; gap: .2rem .9rem; font-size: .85rem; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.ordn-res { font-weight: 700; color: #b45309; }
.ordn-cons { display: block; margin-top: .15rem; }

/* 1.8.3 — storico prodotti */
.stp-prezzo { font-weight: 700; font-variant-numeric: tabular-nums; }
#art-cliente { margin-top: .4rem; }
/* 1.8.4 — storico prezzi del cliente in fondo alla scheda articolo */
#art-cliente .art-dx .st-badge { display: table; margin: .25rem 0 0 auto; }
#art-cliente .stp-prezzo { display: block; font-size: 1.05rem; }
/* 1.8.5 — solo i cambi di prezzo */
.fascia-attuale { border-color: var(--col-primary); }

/* 1.9.0 — pre-ordini */
.st-aperto-pre { background: #dbeafe; color: #1e40af; }
.pre-filtro { margin: .6rem 0 .2rem; }
/* 1.121.0: pagine dell'elenco dei pre-ordini */
.pre-pagine { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .4rem .6rem; margin: .4rem 0; }
.pre-pag-conta { font-size: .85rem; color: var(--col-text-muted); text-align: center; flex-basis: 100%; order: -1; }
.pre-pag-per { display: inline-flex; align-items: center; gap: .3rem; font-size: .85rem; margin: 0; }
.pre-pag-per select { width: auto; margin: 0; padding: .15rem .4rem; }
.pren-riga { border: 1px solid var(--col-border); border-radius: var(--radius); background: #fff; padding: .55rem .7rem; margin-bottom: .45rem; }
.pren-riga.pren-cambiato { border-color: #f59e0b; background: #fffbeb; }
.pren-art { all: unset; cursor: pointer; font-weight: 700; color: var(--col-primary); text-decoration: underline; text-underline-offset: 2px; min-width: 0; }
.pren-togli { flex: none; padding: .1rem .5rem; }
.pren-campi { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .35rem; }
.pren-campi label { font-size: .8rem; margin: 0; }
.pren-campi input { margin-top: .15rem; }
.pren-nota-prezzo { display: block; margin-top: .25rem; color: var(--col-text-muted); }
.pren-cambiato .pren-nota-prezzo { color: #b45309; font-weight: 600; }
.pren-aggiungi { margin: .6rem 0 .8rem; padding: .6rem; border: 1px dashed var(--col-border); border-radius: var(--radius); }
.pren-aggiungi label { margin: 0 0 .3rem; }
/* 1.9.1 — esportazione massiva dei pre-ordini */
.pre-massivo { margin: .2rem 0 .6rem; padding: .5rem .6rem; border: 1px dashed var(--col-border); border-radius: var(--radius); }
.pre-massivo .btn-block { margin-top: .4rem; }
.pre-riga { display: flex; align-items: stretch; gap: .4rem; }
.pre-riga .riga-cliente { flex: 1; min-width: 0; }
.pre-scelta { display: flex; align-items: center; padding: 0 .35rem; margin: 0 0 .35rem; border: 1px solid var(--col-border); border-radius: var(--radius); background: #fff; cursor: pointer; }
.pre-scelta input { width: 1.25rem; height: 1.25rem; margin: 0; }

/* 1.10.0 — clienti da richiamare, conferma pre-ordini, avvisi, stampa */
.tile-larga { grid-column: 1 / -1; min-height: 64px; }
.banner-err { background: #fee2e2; color: #991b1b; border-left: 4px solid var(--col-err); padding: .55rem .7rem; border-radius: 6px; margin: .4rem 0; font-size: .9rem; }
.banner-ok { background: #dcfce7; color: #14532d; border-left: 4px solid var(--col-ok); padding: .55rem .7rem; border-radius: 6px; margin: .4rem 0; font-size: .9rem; }
.st-esportato { background: #e0e7ff; color: #3730a3; }
.ric-card { margin-bottom: .55rem; }
.ric-card .riga-cliente { margin-bottom: .2rem; }
.ric-info { display: block; font-size: .86rem; font-weight: 600; color: #b45309; margin-top: .15rem; }
.ric-sotto { display: block; }
.ric-nascondi { font-size: .78rem; }
.ric-modulo { margin: .35rem 0; padding: .5rem; border: 1px dashed var(--col-border); border-radius: var(--radius); }
.ric-modulo select, .ric-modulo input { margin-bottom: .35rem; }
.ric-nascosto { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; padding: .4rem 0; border-bottom: 1px solid #f1f5f9; }
.ric-nascosto strong { flex: 1 1 100%; }
.ric-banner { background: #fff7ed; border-left: 4px solid #f59e0b; padding: .55rem .7rem; border-radius: 6px; margin: .2rem 0 .6rem; font-size: .9rem; }
.ric-banner-off { background: #f8fafc; border-left-color: var(--col-border); color: var(--col-text-muted); }
#area-stampa { display: none; }
@media print {
  html, body.in-stampa { background: #fff !important; }
  body.in-stampa > *:not(#area-stampa) { display: none !important; }
  body.in-stampa #area-stampa { display: block; color: #000; font: 11pt/1.35 Arial, Helvetica, sans-serif; }
  #area-stampa h1 { font-size: 16pt; margin: .1cm 0; color: #000; }
  #area-stampa .st-ditta { font-weight: 700; font-size: 12pt; color: #1f3b73; }
  #area-stampa .st-testa { border-bottom: 2px solid #1f3b73; padding-bottom: .2cm; margin-bottom: .3cm; }
  #area-stampa .st-cliente { margin: .2cm 0; }
  #area-stampa .st-info { margin: .2cm 0 .3cm; font-size: 10pt; }
  #area-stampa table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  #area-stampa th, #area-stampa td { border-bottom: 1px solid #999; padding: 4px 5px; text-align: left; vertical-align: top; }
  #area-stampa th { background: #eee; white-space: nowrap; }
  #area-stampa td.num { text-align: right; white-space: nowrap; }
  #area-stampa .st-totale { text-align: right; font-weight: 700; font-size: 12pt; margin-top: .3cm; }
  #area-stampa .st-note { margin-top: .3cm; }
  #area-stampa .st-piede { margin-top: .6cm; font-size: 8.5pt; color: #444; }
  @page { size: A4; margin: 1.5cm; }
}

/* 1.11.0 — suggerimenti nel pre-ordine, riepilogo direttore */
.pren-suggeriti { margin: .4rem 0 .6rem; }
.sug-riga { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid #f1f5f9; }
.sug-riga .art-sx small { display: block; color: var(--col-text-muted); font-size: .78rem; }
.sug-dx { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; white-space: nowrap; }
.rie-card { border: 1px solid var(--col-border); border-radius: var(--radius); background: #fff; padding: .6rem .7rem; margin: .5rem 0; }
.rie-totale { border-color: var(--col-primary); background: #f8fafc; }
.rie-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; margin: .4rem 0 .3rem; }
.rie-num { background: #f8fafc; border-radius: 6px; padding: .35rem .5rem; }
.rie-lbl { display: block; font-size: .72rem; color: var(--col-text-muted); }
.rie-val { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.rie-attenzione .rie-val { color: #b45309; }
#rie-excel { margin: .4rem 0 .2rem; }
/* 1.11.1 — ordini per anno nei clienti da richiamare */
.ric-anni { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: .3rem; margin: .35rem 0 .2rem; }
.ric-anno { background: #f8fafc; border-radius: 6px; padding: .25rem .4rem; font-size: .76rem; line-height: 1.25; }
.ric-anno strong, .ric-anno span { display: block; }
.ric-anno span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }
.ric-anno-zero { color: var(--col-text-muted); }
/* 1.12.0 — disponibile con finestra date e scorta di sicurezza */
.art-numeri { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 440px) { .art-numeri { grid-template-columns: repeat(3, 1fr); } }
.art-scorta { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .5rem; margin: .2rem 0 1rem;
  padding: .6rem .7rem; border-radius: 10px; background: #fff7e6; border: 1px solid #f0c36d; }
.art-scorta-riga { display: flex; flex-direction: column; }
.art-scorta-lbl { font-size: .78rem; color: #8a5a00; text-transform: uppercase; letter-spacing: .02em; }
.art-scorta-riga strong { font-size: 1.05rem; }
.art-scorta-riga small { color: #6b6b6b; font-size: .78rem; }
.sez-sotto { font-size: .9rem; color: var(--col-text-muted); margin: .7rem 0 .3rem; font-weight: 600; }
.non-conta { opacity: .65; }

/* ---------- Aiuto «Come calcoliamo il disponibile» (1.12.1): colori pastello leggeri ---------- */
.hl-link { margin: .2rem 0 .8rem; background: #f3f6fb; border-color: #d9e2f0; color: #2f4a73; }
.hl-link.hl-link-alto { margin: -.2rem 0 .6rem; }
.hl-indice { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 1rem; }
.hl-indice a { font-size: .82rem; padding: .25rem .6rem; border-radius: 999px; background: #f2f4f8; color: #3d4b63; text-decoration: none; border: 1px solid #e3e7ee; }
.hl-box { border-radius: 12px; padding: .8rem .9rem; margin: 0 0 1rem; border: 1px solid; color: #2b2f36; line-height: 1.45; scroll-margin-top: 4.5rem; }
.hl-box h2 { margin: 0 0 .5rem; font-size: 1.08rem; color: #2b3a52; }
.hl-box h3 { margin: .7rem 0 .3rem; font-size: .95rem; color: #3b4658; }
.hl-box p { margin: .4rem 0; }
.hl-box ul, .hl-box ol { margin: .3rem 0 .4rem 1.1rem; padding: 0; }
.hl-box li { margin: .15rem 0; }
.hl-blu     { background: #f4f8fd; border-color: #dbe7f6; }
.hl-viola   { background: #f8f6fd; border-color: #e6e0f5; }
.hl-arancio { background: #fdf9f3; border-color: #f2e5d0; }
.hl-azzurro { background: #f3fafb; border-color: #d6ecef; }
.hl-giallo  { background: #fdfcf2; border-color: #efe9c6; }
.hl-verde   { background: #f4faf5; border-color: #d9eedd; }
.hl-rosa    { background: #fcf5f6; border-color: #f1dde0; }
.hl-grigio  { background: #f7f8fa; border-color: #e5e8ed; }
.hl-formula { background: rgba(255,255,255,.75); border: 1px dashed #c9d2df; border-radius: 8px; padding: .5rem .6rem; margin: .5rem 0;
  font-family: ui-monospace, Consolas, monospace; font-size: .86rem; color: #2f3d55; }
.hl-grande { font-size: .95rem; font-weight: 600; text-align: center; }
.hl-formula-in { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; background: rgba(255,255,255,.75); padding: .05rem .35rem; border-radius: 5px; color: #2f3d55; }
.hl-piccolo { font-size: .86rem; color: #5a6270; }
.hl-tab { width: 100%; border-collapse: collapse; margin: .4rem 0; font-size: .86rem; background: rgba(255,255,255,.6); border-radius: 8px; overflow: hidden; }
.hl-tab th, .hl-tab td { padding: .35rem .5rem; border-bottom: 1px solid rgba(0,0,0,.06); text-align: left; vertical-align: top; }
.hl-tab th { font-weight: 600; color: #4a5568; background: rgba(255,255,255,.7); }
.hl-tab td.n { text-align: right; white-space: nowrap; }
.hl-tab tr.hl-tot td { font-weight: 700; border-top: 1px solid rgba(0,0,0,.12); }
.hl-tab tr.hl-scelta td { background: #eaf6ec; font-weight: 600; }
.hl-si { color: #3f8a52; font-weight: 600; }
.hl-no { color: #b4534f; font-weight: 600; }
.hl-due { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .6rem; }
.hl-metodo { background: rgba(255,255,255,.65); border-radius: 10px; padding: .5rem .7rem; border: 1px solid #eee6c4; }
.hl-metodo h3 { margin-top: .1rem; }
.hl-dl dt { font-weight: 600; margin-top: .6rem; color: #4a3b46; }
.hl-dl dd { margin: .2rem 0 0 0; font-size: .9rem; }
.hl-pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.hl-pill-si { background: #e3f3e6; color: #3f8a52; }
.hl-pill-no { background: #f8e3e2; color: #b4534f; }
.hl-pill-ord { background: #eceef2; color: #646c78; }

/* ---------- Telefoni (1.13.0) ---------- */
.tel-lista { display: flex; flex-wrap: wrap; gap: .35rem; }
.tel-btn { display: inline-flex; flex-direction: column; padding: .3rem .6rem; border-radius: 8px; background: #eef7f0; border: 1px solid #cfe8d5;
  color: #1f6b3a; text-decoration: none; line-height: 1.2; min-height: 2.4rem; justify-content: center; }
.tel-btn strong { font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tel-btn span { font-size: .74rem; color: #4b6355; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tel-btn:active { background: #dcefe1; }
.tel-evidenzia { margin: .1rem 0 .35rem; padding: .4rem; background: #f6fbf7; border-radius: 8px; border-left: 4px solid #6fbf87; }
.tel-manca { font-size: .8rem; color: var(--col-text-muted); margin: .1rem 0 .3rem; }
.ric-azioni { align-items: center; flex-wrap: wrap; gap: .3rem; }
.ric-azioni .conta { margin: 0; }
/* 1.33.7: seconda riga dei contatori degli ordini (oggi, mese, anno) */
.ord-riga1, .ord-totali { display: block; overflow: hidden; }
.ord-totali { font-size: .86rem; color: var(--col-primary, #1f3b73); margin-top: .15rem; }
@media print {
  /* 1.13.1: niente pagina orizzontale (sul telefono veniva rimpicciolita a meta' foglio); stessi colori dell'app */
  #area-stampa.st-richiami { font-size: 8.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #area-stampa.st-richiami .st-testa { margin-bottom: .2cm; }
  .stc-riga { display: grid; grid-template-columns: 7.2cm 3.7cm 1fr; gap: .15cm; align-items: start; padding: .1cm .15cm; margin-bottom: .08cm;
    border: 1px solid #e5e7eb; border-radius: 5px; background: #fff; page-break-inside: avoid; break-inside: avoid; }
  .stc-cli { line-height: 1.25; }
  .stc-cli strong { display: block; font-size: 9pt; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stc-cli small { display: block; color: #6b7280; font-size: 7pt; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stc-info { display: block; color: #b45309; font-weight: 700; font-size: 7.5pt; white-space: nowrap; }
  .stc-anni { display: flex; flex-direction: column; gap: .03cm; }
  .stc-anno { display: grid; grid-template-columns: .95cm 1fr 1.5cm; background: #f8fafc; border-radius: 3px; padding: 0 .1cm; font-size: 7pt; line-height: 1.3; }
  .stc-anno b { text-align: right; font-variant-numeric: tabular-nums; }
  .stc-zero { color: #9ca3af; }
  .stc-tel { display: grid; grid-template-columns: 1fr 1fr; gap: .06cm; background: #f6fbf7; border-left: 3px solid #6fbf87; border-radius: 4px; padding: .06cm; align-self: stretch; align-content: flex-start; }
  .stc-tel > small { color: #6b7280; font-size: 7pt; grid-column: 1 / -1; }
  .stc-num { background: #eef7f0; border: 1px solid #cfe8d5; border-radius: 4px; padding: 0 .1cm; color: #1f6b3a; line-height: 1.3; white-space: nowrap; min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .stc-num strong { display: block; font-size: 8pt; font-variant-numeric: tabular-nums; }
  .stc-num span { display: block; font-size: 6.5pt; color: #4b6355; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
}


/* ---------- Follow-up: visite programmate (1.14.0) ---------- */
.fu-riga1 { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.fu-tipo { font-size: .72rem; font-weight: 700; padding: .05rem .5rem; border-radius: 999px; }
.fu-tipo-visita { background: #e0efff; color: #1d4f91; }
.fu-tipo-passo { background: #f1f5f9; color: #475569; }
.card-fu.fu-visita.fu-presto, .card-fu.fu-visita.fu-dopo { background: #f5f9ff; border-left-color: #6aa3e8; }

/* ---------- Ordini clienti dalla home (1.15.0) ---------- */
.ordt-campo { display: block; }
.ordt-sugg { border: 1px solid var(--col-border); border-radius: var(--radius); margin: -.3rem 0 .6rem; background: #fff; overflow: hidden; }
.ordt-sugg-voce { display: block; width: 100%; text-align: left; font: inherit; background: #fff; border: 0; border-bottom: 1px solid #f1f5f9;
  padding: .5rem .7rem; cursor: pointer; color: var(--col-text); }
.ordt-sugg-voce:hover, .ordt-sugg-voce:active { background: #f3f6fb; }
.ordt-sugg-voce strong, .ordt-sugg-voce small { display: block; }
.ordt-sugg-voce small { color: var(--col-text-muted); font-size: .8rem; }
.ordt-sugg .note { padding: .4rem .7rem; margin: 0; }
.ordt-scelto-riga { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: .2rem 0 .6rem;
  padding: .45rem .6rem; background: #eef4fc; border-radius: var(--radius); }
.ordt-scelto-riga .ord-cliente { margin: 0; font-weight: 700; }
.ordt-cli { display: block; font-weight: 600; font-size: .9rem; color: var(--col-primary); margin: .1rem 0; }
#ordt-togli { white-space: nowrap; flex: 0 0 auto; }

/* ---------- Blocco con impronta / Face ID (1.16.0) ---------- */
.blocco { position: fixed; inset: 0; z-index: 1000; background: var(--col-primary); display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.blocco[hidden] { display: none; }
.blocco-box { background: #fff; border-radius: 16px; padding: 1.6rem 1.3rem 1.2rem; max-width: 360px; width: 100%; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.blocco-logo { width: 56px; height: 56px; margin: 0 auto .6rem; border-radius: 14px; background: var(--col-primary); color: #fff; font-weight: 800; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; }
.blocco-box h1 { font-size: 1.2rem; margin: .2rem 0 .3rem; }
.blocco-box p { color: var(--col-text-muted); margin: 0 0 1rem; }
.blocco-esci { margin-top: .9rem; background: none; border: 0; color: var(--col-text-muted); text-decoration: underline; font-size: .82rem; }
body.bloccata { overflow: hidden; }
body.bloccata > *:not(#blocco) { visibility: hidden; }
.blk-stato { font-weight: 600; padding: .5rem .7rem; border-radius: var(--radius); background: #f1f5f9; }
.blk-stato.blk-si { background: #e8f5e9; color: #1f6b3a; }
.blk-stato.blk-no { background: #fff7ed; color: #9a3412; font-weight: 500; }

/* ---------- Cliente sugli impegni, solo amministratore e direttore (1.17.0) ---------- */
#art-impegni .esp-riga, #art-aperti .esp-riga { flex-wrap: wrap; row-gap: .1rem; }
.imp-cli { flex: 1 1 100%; display: block; text-align: left; font: inherit; font-size: .84rem; background: none; border: 0; padding: 0;
  color: var(--col-primary); cursor: pointer; }
button.imp-cli strong, .ord-aperto .imp-cli strong { text-decoration: underline; text-underline-offset: 2px; }
.imp-cli small { color: var(--col-text-muted); }
.imp-cli-no { color: var(--col-text-muted); font-style: italic; cursor: default; }
button.esp-riga { width: 100%; font: inherit; background: #fff; border: 0; border-bottom: 1px solid #f1f5f9; cursor: pointer; text-align: left; color: var(--col-text); }
button.esp-riga:active { background: #f3f6fb; }
.btn-altri { margin: .3rem 0 .6rem; }

/* ---------- Indietro / Home anche in fondo alla pagina (1.17.2) ---------- */
.nav-btns.nav-fondo { display: flex; justify-content: flex-end; gap: .4rem; margin-top: 1.2rem; padding-top: .8rem; border-top: 1px solid var(--col-border); }
.nav-btns.nav-fondo[hidden] { display: none; }
@media print { .nav-fondo { display: none !important; } }

/* ---------- Ufficio vendite (1.18.0) ---------- */
.st-verifica { background: #fef3c7; color: #92400e; }
.banner-avviso { background: #fff7ed; border-left: 4px solid #f59e0b; padding: .55rem .7rem; border-radius: 6px; margin: .3rem 0 .6rem; font-size: .9rem; }

/* Spedizione del pre-ordine (1.19.0): destinazione, spedizioniere, porto */
.pren-sped { margin: .8rem 0 .4rem; }
.pren-sped label { margin-top: .5rem; }
.pren-sped select { width: 100%; margin-top: .2rem; }
.pren-email { margin: .6rem 0 .4rem; }
.pren-email input[type=text] { width: 100%; margin-top: .2rem; }
.pren-email .note { display: block; margin-top: .2rem; }
.pren-email .checkbox { margin-top: .5rem; }
.invia-cliente { margin-top: .5rem; padding: .5rem; border: 1px solid var(--bordo, #e2e6ee); border-radius: 8px; background: #fff; }
.invia-cliente input { width: 100%; margin: .2rem 0 .4rem; }
.pren-invia-cli { margin: .3rem 0 .6rem; }
.pren-invio { margin: .15rem 0; }
.pren-invio.err { color: #b42318; }
.pren-manca { margin: .25rem 0 0; padding: .3rem .55rem; background: #fef9c3; color: #854d0e; border-radius: 6px; font-size: .85rem; font-weight: 600; }

/* Utenti in righe (1.19.1): nome, codice agente, flag, matita */
.ut-griglia { display: grid; grid-template-columns: minmax(0, 1fr) 2.2rem 2.3rem 2.1rem 2.1rem 2.5rem 2.4rem; gap: .25rem; align-items: center; }
.ut-testa { font-size: .7rem; font-weight: 700; color: var(--col-text-muted); text-transform: uppercase; letter-spacing: .02em; padding: 0 .6rem .25rem; border-bottom: 2px solid var(--col-border); }
.ut-testa span:not(:first-child) { text-align: center; }
.ut-riga { border-bottom: 1px solid var(--col-border); padding: .45rem .6rem; background: #fff; }
.ut-riga:nth-child(even) { background: #f8fafc; }
.ut-riga.aperta { background: #eff6ff; }
.ut-riga.stato-disattivato { opacity: .7; }
.ut-nome { min-width: 0; }
.ut-nome strong { display: block; overflow-wrap: anywhere; line-height: 1.25; }
.ut-nome small { display: block; color: var(--col-text-muted); font-size: .8rem; overflow-wrap: anywhere; }
.ut-ag { text-align: center; font-variant-numeric: tabular-nums; }
.ut-flag { text-align: center; font-weight: 700; }
.ut-si { color: #15803d; }
.ut-no { color: #cbd5e1; }
.ut-matita { padding: .15rem .3rem; justify-self: center; }
.ut-modale-sfondo { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.ut-modale { background: #fff; border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.25); width: 100%; max-width: 460px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 1rem 1.1rem; }
.ut-modale-testa { display: flex; justify-content: space-between; align-items: flex-start; gap: .6rem; padding-bottom: .5rem; border-bottom: 1px solid var(--col-border); }
.ut-modale-testa strong { display: block; font-size: 1.05rem; color: var(--col-primary); }
.ut-modale-testa small { display: block; color: var(--col-text-muted); }
.ut-pannello { margin-top: .6rem; }
.ut-email { display: block; color: var(--col-text-muted); }
.ut-campo { display: block; margin: .4rem 0 0; font-size: .85rem; }
.ut-campo input { margin-top: .15rem; }
.ut-ruolo { margin-top: .6rem; }
.ut-pannello .utente-azioni { margin-top: .8rem; padding-top: .6rem; border-top: 1px dashed var(--col-border); }
.ut-salva { margin-top: .9rem; width: 100%; }
/* Confezioni nel pre-ordine (1.20.0) */
.pren-qta-uv { display: flex; gap: .3rem; align-items: stretch; margin-top: .15rem; }
.pren-qta-uv input { margin-top: 0; min-width: 0; flex: 1 1 auto; }
.pren-campi-conf { grid-template-columns: 5.2rem 1fr 1fr; }
.pren-uv { width: 100%; margin-top: .15rem; padding-left: .3rem; padding-right: .2rem; }
.pren-qta-uv input { width: 100%; }
.pren-conf { display: block; margin-top: .25rem; color: var(--col-text-muted); }
.pren-fuoriconf { display: block; margin-top: .25rem; padding: .2rem .45rem; background: #ffedd5; color: #9a3412; border-radius: 5px; font-weight: 600; }
.pren-riga.pren-fuori { border-color: #fb923c; }

/* Clienti del portale (1.21.0) */
.pt-griglia { display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem 2.4rem; gap: .3rem; align-items: center; }
.pt-accesso { color: var(--col-text-muted); text-align: right; font-size: .8rem; }
#btn-nuovo-portale { margin: .3rem 0 .6rem; }

/* Pre-ordini dei clienti dal portale (1.22.0) */
.st-cliente { background: #ede9fe; color: #5b21b6; margin-right: .3rem; }
.banner-cliente { background: #f5f3ff; border-left: 4px solid #7c3aed; padding: .55rem .7rem; border-radius: 6px; margin: .3rem 0 .6rem; font-size: .9rem; color: #4c1d95; }

/* 1.24.0: presa in carico dei pre-ordini */
.st-gestione { background: #fee2e2; color: #991b1b; margin-left: .3rem; }
.st-mio { background: #dcfce7; color: #166534; margin-left: .3rem; }
.banner-gestione { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.home-gestione { display: block; width: 100%; text-align: left; font: inherit; font-size: .9rem; cursor: pointer; border-top: 0; border-right: 0; border-bottom: 0; color: inherit; }
/* 1.24.0: con piu' etichette (dal cliente, stato, in carico) vanno a capo invece di schiacciare il numero */
.pre-riga .ord-r1 { flex-wrap: wrap; justify-content: flex-start; gap: .25rem .4rem; }
.pre-riga .ord-r1 strong { flex: 1 0 100%; }

/* 1.25.0: pagina Utenti con i due elenchi separati e la ricerca */
.ut-hub { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin: .4rem 0 .8rem; }
.ut-hub .tile small { display: block; font-weight: 400; color: var(--muted, #6b7280); font-size: .8rem; }
.ut-cerca-box { margin: .3rem 0 .2rem; }
[data-cerca][hidden] { display: none !important; }

/* 1.26.0: rifare un ordine come pre-ordine, aggiungere dallo storico */
.riga-con-agg { display: flex; align-items: center; gap: .4rem; }
.riga-con-agg .riga-cliente { flex: 1; min-width: 0; }
.btn-agg { white-space: nowrap; }
.rifai { margin: .5rem 0 .2rem; }
.rifai-scelta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .5rem; padding: .6rem; border: 1px solid #e5e7eb; border-radius: 8px; background: #f9fafb; }
.rifai-scelta .note { flex: 1 0 100%; margin: 0 0 .2rem; }
.barra-pre { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); max-width: 92vw; padding: .65rem 1rem; border-radius: 10px; background: #1f3b73; color: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); font-size: .92rem; z-index: 2000; cursor: pointer; }
.toast-ok { background: #166534; }
.toast-err { background: #991b1b; }
@media print { .toast { display: none !important; } }
.riga-con-agg .btn-agg { flex: 0 0 auto; width: 4.8rem; white-space: normal; line-height: 1.15; font-size: .78rem; padding: .45rem .3rem; text-align: center; }

/* 1.28.0: importi nascosti (occhietto nel menu dell'account) */
body.privacy .campo-importo { -webkit-text-security: disc; text-security: disc; }
#account-occhio { font-size: .95em; }

/* 1.29.0: foto degli articoli (dal catalogo di artecaitalia.it) */
.foto-mini { flex: 0 0 auto; width: 48px; height: 48px; border-radius: 8px; border: 1px solid var(--col-border); background: #fff;
    display: inline-flex; align-items: center; justify-content: center; overflow: hidden; font-weight: 800; font-size: .9rem; letter-spacing: .02em; }
.foto-mini img { width: 100%; height: 100%; object-fit: contain; display: block; }
.foto-mini.foto-con { cursor: zoom-in; }
.foto-mini.foto-con:hover { border-color: var(--col-primary-light); }
.foto-mini.foto-senza { border-color: transparent; background: #f1f5f9; color: #64748b; }
.riga-art .art-sx, .sug-riga .art-sx { flex: 1 1 0; min-width: 0; }
/* 1.29.1: con la foto la colonna del testo restava strettissima (storico prodotti): a destra si va a capo */
.riga-art .art-dx { flex: 0 1 auto; max-width: 34%; white-space: normal; }
.riga-con-agg .foto-mini { width: 40px; height: 40px; }
.riga-con-agg .riga-art { display: grid; grid-template-columns: auto 1fr; column-gap: .6rem; row-gap: .2rem; align-items: center; }
.riga-con-agg .riga-art .art-dx { grid-column: 2; max-width: none; text-align: left; display: flex; flex-wrap: wrap; gap: .1rem .6rem; align-items: baseline; }
.riga-con-agg .riga-art .art-dx small { display: inline; }
.riga-con-agg .riga-art:not(:has(.foto-mini)) { grid-template-columns: 1fr; }
.riga-con-agg .riga-art:not(:has(.foto-mini)) .art-dx { grid-column: 1; }
.ord-r1 .foto-mini { align-self: center; }
.ord-r1 > strong, .ord-r1 > .pren-art { flex: 1 1 auto; }
.ord-r1:has(.foto-mini) { align-items: center; }
.art-foto { text-align: center; margin: .2rem 0 .6rem; }
.foto-testa { max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 10px; border: 1px solid var(--col-border); background: #fff; cursor: zoom-in; }
.foto-grande { position: fixed; inset: 0; z-index: 3000; background: rgba(15, 23, 42, .9); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.foto-grande figure { margin: 0; text-align: center; }
.foto-grande img { width: min(60vw, 300px); max-width: 92vw; max-height: 74vh; object-fit: contain; background: #fff; border-radius: 10px; }
.foto-grande figcaption { color: #fff; margin-top: .6rem; font-size: .95rem; max-width: 92vw; }
.foto-chiudi { position: absolute; top: .8rem; right: .8rem; }
@media print { .foto-mini, .art-foto { display: none !important; } }

/* 1.30.0: guide */
.guide-lista { display: flex; flex-direction: column; gap: .7rem; margin-top: .8rem; }
.guida-tile { text-decoration: none; text-align: left; align-items: flex-start; padding: 1rem 1.1rem; }
.guida-tile strong { font-size: 1.05rem; }
.guida-tile small { display: block; color: var(--col-text-muted); font-weight: 400; margin-top: .2rem; }

/* 1.31.0: ordinamento degli elenchi */
.ordina-riga { display: flex; align-items: center; gap: .5rem; margin: .4rem 0 .2rem; font-size: .9rem; color: var(--col-text-muted); }
.ordina-riga select { flex: 1; max-width: 16rem; }

/* 1.32.0: foto fatte da Arteca (aggiungi, ritaglia, togli) */
.foto-origine { display: block; color: var(--col-text-muted); font-size: .78rem; margin-top: .25rem; }
.foto-azioni { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-top: .5rem; }
.foto-editor { position: fixed; inset: 0; z-index: 3100; background: rgba(15, 23, 42, .92); display: flex; align-items: center; justify-content: center; padding: .8rem; }
.fe-box { background: #fff; border-radius: 12px; padding: .9rem; max-width: 100%; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.fe-box > strong { align-self: stretch; }
.fe-box > small { align-self: stretch; color: var(--col-text-muted); }
.fe-area { position: relative; overflow: hidden; touch-action: none; user-select: none; line-height: 0; border: 1px solid var(--col-border); }
.fe-area canvas { display: block; }
.fe-taglio { position: absolute; border: 2px solid #fff; outline: 1px solid rgba(0, 0, 0, .4); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5); pointer-events: none; }
/* 1.46.2: maniglie agli angoli della cornice, come nella galleria del telefono */
.fe-man { position: absolute; width: 24px; height: 24px; border: 0 solid #e11d2a; }
.fe-man-nw { left: -2px; top: -2px; border-left-width: 5px; border-top-width: 5px; }
.fe-man-ne { right: -2px; top: -2px; border-right-width: 5px; border-top-width: 5px; }
.fe-man-sw { left: -2px; bottom: -2px; border-left-width: 5px; border-bottom-width: 5px; }
.fe-man-se { right: -2px; bottom: -2px; border-right-width: 5px; border-bottom-width: 5px; }
.fe-rapporto { align-items: center; }
.fe-rapporto > span { font-size: .88rem; color: var(--col-text-muted); }
.fe-azioni { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.foto-editor { overflow-y: auto; align-items: flex-start; }
.fe-box { margin: auto; }
.fe-regola { align-self: stretch; display: flex; flex-direction: column; gap: .3rem; }
.fe-cursore { display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--col-text-muted); }
.fe-cursore span { flex: 0 0 6.5rem; }
.fe-cursore input { flex: 1; min-width: 0; }
.st-annullato { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }

/* 1.34.0: offerte */
.st-offerta { background: #dbeafe; color: #1e40af; }
.st-tipo-off { background: #1e40af; color: #fff; margin-right: .3rem; }
.st-tipo-dalloff { background: #e0e7ff; color: #3730a3; margin-right: .3rem; }
.pren-tipo { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0; }
.pren-tipo-tit { font-weight: 600; margin-right: .2rem; }
.pren-tipo .note { flex-basis: 100%; margin: 0; }
/* 1.63.0: consegna desiderata di fianco a Ordine / Offerta, e per riga */
.pren-cons { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; font-size: .8rem; margin: .35rem 0 0; }
.pren-cons input { width: auto; margin: 0; padding: .2rem .4rem; font-size: .85rem; }
.pren-cons .note { margin: 0; }
.pren-cons-sua input { border-color: #2c7be5; background: #eff6ff; font-weight: 600; }
.riga-off { display: block; color: #1e40af; font-size: .8rem; margin-top: .15rem; }
.riga-agg { display: block; color: #b45309; font-weight: 600; font-size: .8rem; margin-top: .15rem; }
.pren-riga.pren-agg { border-color: #f59e0b; border-left-width: 4px; }
.pren-riga input:disabled, .pren-riga select:disabled { background: #f3f4f6; color: #374151; }

/* 1.35.2: piede «software Ciegi Soft» e marchio in testo (finche' non c'e' l'immagine) */
.piede-ciegi { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: .3em; margin-top: .25rem; }
.piede-ciegi:hover { text-decoration: underline; }
.ciegi-marchio { display: inline-flex; align-items: flex-start; font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.ciegi-marchio .cm-ciegi { color: #3aa335; font-size: 1.25em; }
.ciegi-marchio .cm-soft { color: #2b9fd8; font-size: .72em; margin-left: .06em; }
.menu-account a.menu-voce { display: block; padding: .6rem .9rem; color: inherit; text-decoration: none; }
.menu-account a.menu-voce:hover { background: #f3f6fb; }
.menu-account a.menu-voce, .menu-account a.menu-voce:visited { color: var(--col-text, #1f2937); }
.ciegi-logo { height: 2em; width: auto; vertical-align: middle; }
.campo-errato { border-color: #b42318 !important; background: #fff5f4; }
.pren-email .note.err { color: #b42318; }

/* 1.39.0: ricerca intelligente — chip di quello che l'app ha capito, barra dei suggerimenti, «?» */
.rc-aiuto { flex: 0 0 auto; width: 34px; height: 34px; margin: 0.3rem 0 0; border-radius: 50%; border: 1px solid var(--col-primary-light);
    background: #fff; color: var(--col-primary); font-weight: 700; font-size: 1rem; cursor: pointer; padding: 0; line-height: 1; }
.rc-aiuto:hover { background: var(--col-info-bg); }
.rc-campo { display: flex; align-items: flex-start; gap: 0.4rem; }
.rc-campo > input { flex: 1 1 auto; min-width: 0; }
.ricerca-riga > .con-mic .rc-aiuto { margin-top: 0; align-self: center; }
.rc-chip-box { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.15rem 0 0.5rem; align-items: center; }
.rc-chip { display: inline-flex; align-items: baseline; gap: 0.3rem; border: 1px solid #c7d4ef; background: #eef3fc; color: var(--col-primary-dark);
    border-radius: 999px; padding: 0.22rem 0.65rem; font-size: 0.82rem; cursor: pointer; max-width: 100%; text-align: left; line-height: 1.3; }
.rc-chip b { font-weight: 600; color: var(--col-primary); }
.rc-chip small { color: var(--col-text-muted); font-size: 0.75rem; }
.rc-chip.rc-libero { background: #f3f4f6; border-color: var(--col-border); }
.rc-chip.rc-neg { background: #fdf0f0; border-color: #f2c4c4; }
.rc-chip.rc-neg b { color: #a61b1b; }
.rc-chip.rc-avviso { background: #fff7e6; border-color: #f5d08a; color: #7a4d00; }
.rc-nota { color: var(--col-text-muted); font-size: 0.8rem; }
.rc-forse { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-size: 0.85rem; color: var(--col-text-muted); }
/* la barra: una riga che scorre col dito sul telefono, tutta visibile sul PC */
.rc-barra { display: flex; gap: 0.6rem; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin;
    background: #f8fafc; border: 1px solid var(--col-border); border-radius: var(--radius); padding: 0.35rem 0.45rem; margin: 0 0 0.6rem; white-space: nowrap; }
.rc-gruppo { display: inline-flex; gap: 0.3rem; align-items: center; flex: 0 0 auto; }
.rc-gruppo + .rc-gruppo { border-left: 1px solid var(--col-border); padding-left: 0.6rem; }
.rc-tit { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--col-text-muted); margin-right: 0.15rem; }
.rc-voce { flex: 0 0 auto; border: 1px solid #c7d4ef; background: #fff; color: var(--col-primary-dark); border-radius: 999px;
    padding: 0.3rem 0.7rem; font-size: 0.85rem; cursor: pointer; white-space: nowrap; min-height: 32px; }
.rc-voce:hover { background: var(--col-info-bg); }
.rc-voce.rc-op { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; min-width: 38px; }
.rc-voce.rc-azione { border-color: var(--col-border); color: var(--col-text); }
.rc-voce.rc-togli { color: var(--col-err); border-color: #f2c4c4; }
.rc-voce.rc-forse-voce { font-weight: 600; }
.rc-chiudi { flex: 0 0 auto; margin-left: auto; border: 0; background: transparent; color: var(--col-text-muted); font-size: 1rem; cursor: pointer; padding: 0.2rem 0.4rem; min-height: 32px; }
@media (min-width: 768px) {
    .rc-barra { flex-wrap: wrap; white-space: normal; overflow-x: visible; }
    .rc-gruppo { flex-wrap: wrap; }
    .rc-gruppo + .rc-gruppo { border-left: 0; padding-left: 0; }
    .rc-gruppo { width: 100%; }
    .rc-chiudi { position: absolute; right: 0.3rem; top: 0.2rem; }
    .rc-barra { position: relative; padding-right: 2rem; }
}
select.rc-ignorato { opacity: 0.55; }
.rc-periodo { margin-top: 0.2rem; }
/* finestre: aiuto e calendario */
.rc-aiuto-modale { max-width: 560px; }
.rc-aiuto-modale h3 { font-size: 0.95rem; color: var(--col-primary); margin: 0.9rem 0 0.35rem; }
.rc-aiuto-intro, .rc-aiuto-testo { font-size: 0.88rem; margin: 0.4rem 0; line-height: 1.45; }
.rc-esempi { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.rc-esempio { border: 1px solid #c7d4ef; background: #eef3fc; color: var(--col-primary-dark); border-radius: 999px; padding: 0.3rem 0.7rem; font-size: 0.85rem; cursor: pointer; }
.rc-campi { display: grid; grid-template-columns: 1fr; gap: 0.25rem; }
.rc-campo-riga { font-size: 0.86rem; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.rc-campo-riga small { color: var(--col-text-muted); }
.rc-cal-modale label { margin-bottom: 0.6rem; }
.rc-cal-modale .btn-primary { margin-top: 0.6rem; width: 100%; }
/* 1.39.0: sul telefono il campo di ricerca delle visite va a tutta larghezza (sotto il periodo) */
@media (max-width: 600px) {
    .griglia-2.filtri { grid-template-columns: 1fr; }
}
/* 1.39.2: «Cerca in» + «+ filtro» in tutte le ricerche (il <label> che conteneva il campo diventa un <div>) */
.rc-label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 500; }
.rc-label > .ricerca { margin-top: 0.25rem; font-weight: 400; }
.ricerca-riga select.ricerca-campo { font-size: 0.9rem; }
/* 1.39.3: finestra «Database del server» */
.db-modale { max-width: 640px; }
.db-modale h3.db-sez { font-size: 0.95rem; color: var(--col-primary); margin: 1rem 0 0.4rem; border-bottom: 1px solid var(--col-border); padding-bottom: 0.2rem; }
.db-modale #db-anni { max-width: 8rem; }
.db-modale #btn-db-anni { margin-top: 0.4rem; }

/* 1.40.0: barretta delle utility (sotto la testata, sempre visibile) */
.barra-utility { background: #e8eefb; color: var(--col-primary-dark); border-top: 1px solid rgba(255,255,255,.25); box-shadow: inset 0 -1px 0 #c7d4ef; }
.barra-utility[hidden] { display: none; }
.bu-dentro { display: flex; gap: 0.15rem; max-width: none; margin: 0 auto; padding: 0.15rem 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.bu-dentro::-webkit-scrollbar { display: none; }
.bu-voce { flex: 0 0 auto; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
    min-width: 54px; padding: 0.2rem 0.35rem; border: 0; border-radius: 8px; background: transparent; color: var(--col-primary-dark); cursor: pointer; line-height: 1.1; }
.bu-voce:hover, .bu-voce:focus-visible { background: #d5e1f8; outline: none; }
.bu-ic { font-size: 1.15rem; line-height: 1.2; }
.bu-nome { font-size: 0.66rem; font-weight: 600; letter-spacing: .01em; }
.bu-imposta { margin-left: auto; opacity: .75; }
/* finestre delle utility */
.ub-modale { max-width: 420px; }
.ub-scelte .btn { margin-top: 0.5rem; text-align: left; }
.ub-calc { max-width: 360px; }
.ub-nastro { min-height: 1.2rem; font-size: 0.78rem; color: var(--col-text-muted); text-align: right; margin-top: 0.5rem; }
.ub-nastro div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ub-schermo { background: #0f1f3d; color: #fff; border-radius: 10px; padding: 0.5rem 0.75rem; margin: 0.4rem 0 0.6rem; text-align: right; cursor: copy; min-height: 3.4rem; }
.ub-schermo small { display: block; color: #b8c7e6; font-size: 0.75rem; text-align: left; }
.ub-valore { font-size: 1.8rem; font-variant-numeric: tabular-nums; word-break: break-all; }
.ub-valore.ub-lungo { font-size: 1.3rem; }
.ub-tasti { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }
.ub-tasto { border: 1px solid var(--col-border); background: #fff; border-radius: 10px; font-size: 1.15rem; padding: 0.6rem 0; cursor: pointer; color: var(--col-text); }
.ub-tasto:active { background: #eef3fc; }
.ub-tasto.ub-op { background: #eef3fc; color: var(--col-primary); font-weight: 700; }
.ub-tasto.ub-fn { background: #f3f4f6; }
.ub-tasto.ub-uguale { background: var(--col-primary); color: #fff; }
.ub-speciali { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; margin-top: 0.45rem; }
.ub-tasto.ub-spec { font-size: 0.8rem; padding: 0.55rem 0.2rem; background: #fff7e6; border-color: #f5d08a; color: #7a4d00; font-weight: 600; }
.ub-svuota { font-size: 0.8rem; margin-top: 0.5rem; }
.ub-risultati .ub-sez h3 { font-size: 0.85rem; color: var(--col-primary); margin: 0.8rem 0 0.3rem; }
.ub-cerca .con-mic { margin-top: 0.6rem; }
.ub-esito { margin-top: 0.6rem; }
.ub-grande { font-size: 1.05rem; }
.ub-video { width: 100%; max-height: 50vh; background: #000; border-radius: 10px; margin-top: 0.6rem; }
.ub-a-mano { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.ub-a-mano input { flex: 1; }
.ub-testo { width: 100%; margin-top: 0.6rem; }
.ub-azioni { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.ub-lista { margin-top: 0.4rem; }
.ub-riga { display: flex; align-items: center; gap: 0.3rem; padding: 0.25rem 0; border-bottom: 1px solid var(--col-border); }
.ub-riga label { flex: 1; margin: 0; font-weight: 400; }

/* 1.41.0: Scegli con gruppi e collegamenti personali */
.ub-scegli .ub-gruppo { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin: .9rem 0 .2rem; opacity: .8; }
.ub-scegli .ub-gruppo:first-child { margin-top: .3rem; }
.ub-nuovo-link { margin: .4rem 0 .2rem; }
.ub-link-form { display: grid; gap: .35rem; margin-top: .4rem; }
.ub-link-form input { width: 100%; padding: .5rem .6rem; font-size: 1rem; border: 1px solid #cbd2dd; border-radius: 8px; }
.ub-link-form .btn { justify-self: start; }

/* 1.41.6: tasti della calcolatrice affidabili sul telefono (niente zoom col doppio tocco, niente selezione) */
.ub-tasto { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.ub-tasto.premuto { filter: brightness(.9); transform: scale(.97); }
.ub-tasti, .ub-speciali { touch-action: manipulation; }

/* 1.42.0: strumenti in piu' della barretta (converti, date, scadenze, P.IVA, cronometro, incolla, tasti) e stampa */
.ub-campo { display: block; margin-top: .55rem; }
.ub-campo input, .ub-campo select { display: block; width: 100%; margin-top: .2rem; }
.ub-due { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.ub-due .ub-campo { min-width: 0; }
.ub-modale h3.ub-gruppo { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; margin: .9rem 0 .1rem; color: var(--col-primary); }
.ub-esito p { margin: .25rem 0; }
.ub-ok { color: #157347; font-weight: 600; }
.ub-no { color: #b02a37; font-weight: 600; }
.ub-tasti-rapidi kbd { display: inline-block; min-width: 4.2rem; padding: .1rem .35rem; border: 1px solid var(--col-border); border-bottom-width: 2px; border-radius: 5px; background: #f8fafc; font: .8rem/1.4 ui-monospace, Consolas, monospace; text-align: center; }
.ub-crono .ub-valore { font-size: 2.4rem; }
@media print {
  .barra-utility, .ut-modale-sfondo { display: none !important; }
}

/* 1.43.0: barretta che scorre sul PC (frecce, trascinamento), numero delle scadenze, finestra Scadenze */
.barra-utility { position: relative; }
.bu-freccia { position: absolute; top: 0; bottom: 0; width: 2rem; border: 0; padding: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; z-index: 2; color: inherit; }
.bu-freccia[hidden] { display: none; }
.bu-sx { left: 0; background: linear-gradient(to right, #e8eefb 60%, transparent); text-align: left; padding-left: .3rem; }
.bu-dx { right: 0; background: linear-gradient(to left, #e8eefb 60%, transparent); text-align: right; padding-right: .3rem; }
.bu-dentro.trascina { cursor: grabbing; user-select: none; }
.bu-dentro.trascina .bu-voce { pointer-events: none; }
.bu-voce { position: relative; }
.bu-badge { position: absolute; top: 1px; right: 2px; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px; background: #dc3545; color: #fff; font-size: .68rem; font-weight: 700; line-height: 1.05rem; text-align: center; }
.ub-schede { display: flex; gap: .3rem; margin-top: .6rem; }
.ub-scheda { flex: 1; border: 1px solid var(--col-border); background: #fff; border-radius: 8px; padding: .45rem .3rem; font: inherit; font-size: .9rem; cursor: pointer; color: inherit; }
.ub-scheda.attiva { background: var(--col-primary); border-color: var(--col-primary); color: #fff; font-weight: 600; }
.ub-tre { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: .5rem; }
.ub-tre .ub-campo { min-width: 0; }
.ub-scad .checkbox { margin-top: .6rem; }
.ub-passata { opacity: .55; }
.ub-scad-riga { display: flex; align-items: center; gap: .3rem; padding: .45rem 0; border-bottom: 1px solid var(--col-border); }
.ub-scad-testo { flex: 1; min-width: 0; }
.ub-scad-testo strong, .ub-scad-testo small { display: block; }
.ub-scad-testo small { color: var(--col-text-muted); font-size: .8rem; }
.ub-vicina strong { color: #b02a37; }


/* 1.43.1: sul PC le finestre degli strumenti sono mobili (si trascinano dal titolo), piu' d'una aperta, pagina usabile */
.ut-modale.ub-finestra { position: fixed; margin: 0; width: 420px; max-height: calc(100vh - 24px); z-index: 900; box-shadow: 0 10px 34px rgba(0,0,0,.22), 0 0 0 1px rgba(15,31,61,.08); }
.ub-finestra .ut-modale-testa { cursor: move; -webkit-user-select: none; user-select: none; touch-action: none; }
.ub-finestra:not(.ub-davanti) { box-shadow: 0 4px 14px rgba(0,0,0,.16), 0 0 0 1px rgba(15,31,61,.08); }
.ub-finestra:not(.ub-davanti) .ut-modale-testa strong { opacity: .7; }
.ub-finestra.ub-sposto { opacity: .92; }
.ub-gcal { margin-top: .6rem; }
.ub-gcal[hidden] { display: none; }
.btn.ub-conferma { background: #dc3545; border-color: #dc3545; color: #fff; }
@media print { .ub-finestra { display: none !important; } }

/* 1.43.2: impostazioni dell'amministratore nascoste nella pagina, si modificano in una finestra */
.imp-riga { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin: .2rem 0 .4rem; }
.imp-riga .note { margin: 0; }
.ut-modale.imp-modale { max-width: 560px; }
.imp-modale .imp-campi { margin-top: .5rem; }
.imp-modale .imp-campi label { display: block; margin-top: .5rem; }
.imp-modale .imp-campi input, .imp-modale .imp-campi select { width: 100%; }
.imp-modale .imp-campi .btn { margin-top: .7rem; }

/* 1.44.0 (portale 1.13.3) — ricerca: tendina «Cerca in» stretta e campo largo; contorno rosso su TUTTI i campi di ricerca (standard, Gae) */
.ricerca-riga select.ricerca-campo { flex: 0 0 auto; width: 5.2rem; max-width: 26%; min-width: 0; padding-left: .45rem; padding-right: .25rem; text-overflow: ellipsis; }
.ricerca-riga > .con-mic { flex: 1 1 auto; }
input[type="search"] { border: 2px solid #dc3545 !important; }
input[type="search"]:focus { border-color: #dc3545 !important; outline: none; box-shadow: 0 0 0 3px rgba(220, 53, 69, .2) !important; }
/* 1.44.0 — calcolatrice: tasto «Prezzo» con i delta memorizzati */
.ub-tasto.ub-spec.ub-prezzo-tasto { grid-column: 1 / -1; background: #28a745; border-color: #1e7e34; color: #fff; font-size: .9rem; }
.ub-prezzo { margin: .45rem 0 .2rem; padding: .5rem .55rem; border: 1px solid #b7dfc2; background: #f0faf3; border-radius: 10px; }
.ub-prezzo-tit { font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.ub-prezzo-riga { display: flex; gap: .4rem; align-items: flex-end; }
.ub-calc .ub-prezzo-scelta { flex: 1 1 auto; min-width: 0; margin: 0; padding: .45rem .4rem; font-size: .95rem; border: 1px solid #9fd3ad; border-radius: 8px; background: #fff; }
.ub-prezzo-delta { flex: 0 0 5.2rem; display: flex; flex-direction: column; font-size: .72rem; color: #4b5563; margin: 0; }
.ub-calc .ub-prezzo-delta input { width: 100%; margin: .1rem 0 0; padding: .45rem .4rem; font-size: .95rem; border: 1px solid #9fd3ad; border-radius: 8px; text-align: right; }
.ub-prezzo-imposta { display: inline-block; margin-top: .35rem; font-size: .82rem; }
.ub-prezzo .note { display: block; margin: 0 0 .35rem; font-size: .76rem; }
.ub-prezzo-campi { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; }
.ub-calc .ub-prezzo-campi input { width: 100%; min-width: 0; margin: 0; padding: .45rem .3rem; font-size: .95rem; border: 1px solid #9fd3ad; border-radius: 8px; text-align: right; }
.ub-prezzo-azioni { display: flex; gap: .4rem; margin-top: .45rem; }
.ub-prezzo-azioni .btn { padding: .4rem .9rem; }

/* 1.46.0 — assistenza nel portale: «Entra come» e prove */
.pt-griglia { grid-template-columns: minmax(0, 1fr) 6.5rem auto; }
.pt-bottoni { display: inline-flex; gap: .3rem; justify-content: flex-end; }
.pt-prove { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; }
.pv-prova { display: inline-block; background: #dc3545; color: #fff; font-weight: 700; font-size: .7rem; letter-spacing: .04em; padding: .05rem .4rem; border-radius: 4px; vertical-align: middle; }

/* 1.47.0: bolle (DDT) nel dettaglio ordine */
.ddt-elenco { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }

/* visore PDF a tutto schermo: bolle e conferme d'ordine (app 1.47.2 / portale 1.15.1) */
.pdfv { position: fixed; inset: 0; z-index: 3000; background: #1e293b; display: flex; flex-direction: column; }
.pdfv-barra { display: flex; align-items: center; gap: .4rem; padding: .5rem .6rem; padding-top: max(.5rem, env(safe-area-inset-top)); background: #0f172a; color: #fff; flex-wrap: wrap; }
.pdfv-tit { flex: 1 1 8rem; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfv-btn { border: 0; border-radius: 8px; padding: .45rem .7rem; font-size: .95rem; font-weight: 600; color: #fff; background: #334155; cursor: pointer; min-height: 2.4rem; }
.pdfv-btn:disabled { opacity: .45; cursor: default; }
.pdfv-zoom { min-width: 2.6rem; font-size: 1.2rem; }
.pdfv-scarica { background: #2c7be5; }
.pdfv-chiudi { background: #dc3545; }
.pdfv-perc { color: #cbd5e1; min-width: 3rem; text-align: center; font-size: .9rem; }
.pdfv-area { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.pdfv-pagine { display: flex; flex-direction: column; align-items: center; gap: .6rem; padding: .5rem; width: max-content; min-width: 100%; box-sizing: border-box; }
.pdfv-pagina { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .4); flex: none; }
.pdfv-foglio { display: block; width: 100%; height: 100%; }
.pdfv-stato { color: #e2e8f0; text-align: center; padding: 2rem 1rem; }
@media (max-width: 560px) { .pdfv-lungo { display: none; } .pdfv-barra { flex-wrap: nowrap; gap: .3rem; } .pdfv-btn { padding: .45rem .6rem; } .pdfv-zoom { min-width: 2.3rem; } .pdfv-tit { font-size: .9rem; } .pdfv-perc { min-width: 2.6rem; font-size: .8rem; } }
.toast { z-index: 3100; }   /* sopra il visore PDF */
/* 1.47.4 / portale 1.15.3: conferma e bolle toccabili dentro la riga della lista, accanto a righe e importo */
.pdf-link { display: inline-block; padding: .05rem .4rem; margin: .1rem 0; border-radius: 6px; background: #e8f0fe; color: #1a4fa3; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: underline; text-underline-offset: 2px; }
.pdf-link:active { background: #c9dafc; }
.pdf-link:focus-visible { outline: 2px solid #2c7be5; outline-offset: 1px; }
/* stampa dal visore PDF (app 1.47.3 / portale 1.15.2): solo le pagine del documento, una per foglio */
.pdfv-stampa { display: none; }
.pdfv-stampa-btn { background: #6f42c1; }
@media print {
  @page pdfv { size: A4; margin: 0; }          /* pagina con nome: non tocca le altre stampe dell'app */
  body.pdfv-in-stampa > .pdfv-stampa { page: pdfv; }
  body.pdfv-in-stampa > *:not(.pdfv-stampa) { display: none !important; }
  body.pdfv-in-stampa { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body.pdfv-in-stampa > .pdfv-stampa { display: block !important; }
  .pdfv-stampa > div { break-after: page; page-break-after: always; display: flex; align-items: flex-start; justify-content: center; }
  .pdfv-stampa > div:last-child { break-after: auto; page-break-after: auto; }
  .pdfv-stampa img { display: block; max-width: 209mm; max-height: 295mm; width: auto; height: auto; }
}

/* ===== 1.48.0: Riepiloghi e statistiche ===== */
.stat-menu { display: flex; flex-direction: column; gap: .5rem; margin-top: .4rem; }
.stat-voce { display: flex; align-items: center; gap: .6rem; width: 100%; text-align: left; background: #fff; border: 1px solid var(--col-border);
  border-radius: var(--radius); padding: .6rem .7rem; font: inherit; color: inherit; cursor: pointer; }
.stat-voce:hover, .stat-voce:focus-visible { border-color: var(--col-primary); }
.stat-voce-menu { padding: .8rem .8rem; }
.stat-ico { font-size: 1.6rem; line-height: 1; flex: none; }
.stat-voce-sx { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.stat-voce-sx strong { overflow-wrap: anywhere; }
.stat-voce-sx small { color: var(--col-text-muted); overflow-wrap: anywhere; }
.stat-voce-dx { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-lista { display: flex; flex-direction: column; gap: .35rem; margin: .3rem 0 .6rem; }
.stat-azioni { display: flex; gap: .4rem; justify-content: flex-end; margin: .2rem 0 .4rem; }
.stat-filtri { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .4rem; margin: .2rem 0 .4rem; }
.stat-filtri label { margin: 0; }
.stat-filtri select { width: 100%; }
.stat-kpi { grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); }
.stat-sez { font-size: 1.05rem; color: var(--col-primary); margin: 1rem 0 .3rem; }
.stat-cliente { display: flex; flex-direction: column; margin: .2rem 0 .4rem; }
.stat-cliente strong { font-size: 1.1rem; }
.stat-cliente small { color: var(--col-text-muted); }
.stat-bolle { display: flex; flex-wrap: wrap; gap: .35rem; }
.stat-visita { margin: .15rem 0; font-size: .9rem; }
/* 1.53.0: statistiche di utilizzo */
.uso-voce { cursor: default; }
.uso-zero { background: #f6f7f9; }
.uso-zero .stat-voce-sx strong { color: var(--col-text-muted); }
.uso-cerca { width: 100%; margin: .2rem 0 .3rem; }
.uso-veloci { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .4rem; }
.uso-app-tit { margin-top: .6rem; }
.stat-filtri input[type=date] { width: 100%; }
.stat-periodo-cli { align-items: end; grid-template-columns: minmax(0, 12rem) minmax(0, 12rem) minmax(0, 15rem) auto; justify-content: start; }   /* 1.133.0: Dal… Al… della scheda cliente (1.133.1: e Costo) */
@media (max-width: 600px) { .stat-periodo-cli { grid-template-columns: 1fr 1fr; } .stat-periodo-cli > label:nth-child(3), .stat-periodo-cli > button { grid-column: 1 / -1; } }
/* 1.54.0: ricarico sul costo con la freccetta rossa (discreto) */
.ric { display: block; font-size: .78rem; color: var(--col-text-muted); font-variant-numeric: tabular-nums; line-height: 1.3; margin-top: .1rem; }
.ric-fr { color: #c62828; font-weight: 700; font-size: .8em; }
.ric-su { color: #1b7f3b; font-weight: 600; }
.ric-giu { color: #c62828; font-weight: 600; }
.ric-aum { color: #6f42c1; font-weight: 700; white-space: nowrap; }   /* 1.132.5: aumento di prezzo per recuperare il ricarico (1.132.6: viola, non si confonde con rosso/verde) */
@media (max-width: 600px) { td .ric-aum { display: block; } }
.rie-num .ric { font-size: .74rem; }
.stat-tab-box { overflow-x: auto; }
.stat-tab { width: 100%; border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.stat-tab th, .stat-tab td { border-bottom: 1px solid var(--col-border); padding: .3rem .35rem; text-align: left; white-space: nowrap; }
.stat-tab th { color: var(--col-text-muted); font-weight: 600; }
.stat-tab .num { text-align: right; }
.stat-tab .stat-tot td { font-weight: 700; }
.stat-tab tr.ric-sospetta td { background: #fdecea; }
.stat-tab tr.ric-sospetta td:first-child { color: #c62828; font-weight: 700; }
/* 1.56.0: ricarico toccabile e finestra con gli articoli */
.ric-tocca { cursor: pointer; text-decoration: underline dotted #c62828; text-underline-offset: 3px; border-radius: 4px; -webkit-tap-highlight-color: rgba(198, 40, 40, .15); }
.ric-tocca:hover, .ric-tocca:focus-visible { background: #fdecea; outline: none; }
.graf-info .ric { margin-top: .2rem; }
.ut-modale.rca-modale { max-width: 900px; }
.rca-modale .stat-kpi { margin-top: .6rem; }
.rca-cerca { width: 100%; margin: .2rem 0 .4rem; }
/* 1.134.0: «solo negativi» di fianco al ricarico negativo; Mostra nella finestra; articoli negativi per cliente */
.ric-con-neg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
.ric-neg { font-size: .68rem; line-height: 1.2; padding: .1rem .45rem; border: 1px solid #6f42c1; color: #6f42c1; background: #fff; border-radius: 999px; cursor: pointer; white-space: nowrap; font-weight: 600; }
.ric-neg:hover, .ric-neg:focus-visible { background: #6f42c1; color: #fff; }
.rca-filtri { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .2rem 0 .4rem; }
.rca-filtri .rca-cerca { flex: 1 1 14rem; width: auto; margin: 0; }
.rca-mostra { display: flex; align-items: center; gap: .35rem; margin: 0; font-size: .85rem; }
.neg-cli { margin: .7rem 0 1rem; border: 1px solid #e3e8ef; border-radius: 10px; overflow: hidden; }
.neg-testa { display: grid; grid-template-columns: 1fr auto; gap: .15rem .6rem; width: 100%; text-align: left; padding: .55rem .7rem; background: #eef2ff; border: 0; border-bottom: 1px solid #d7def0; cursor: pointer; font: inherit; color: inherit; }
.neg-testa:hover { background: #e2e8ff; }
.neg-nome strong { display: block; color: #1e3a8a; }
.neg-nome small, .neg-num small { display: block; font-size: .75rem; color: #5b6475; }
.neg-num { text-align: right; }
.neg-num strong { color: #c62828; }
.neg-sotto { grid-column: 1 / -1; font-size: .78rem; color: #3b4352; }
.neg-cli .stat-tab-box { margin: 0; border: 0; border-radius: 0; }
.neg-tab td.neg-eur { color: #c62828; font-weight: 600; }
.neg-testa-st { font-size: .95rem; margin: .8rem 0 .3rem; }
.rca-tab td { vertical-align: top; }
.rca-tab th small { display: block; font-weight: 400; font-size: .7rem; }
.rca-tab .rca-th { display: block; }
.rca-tab td.rca-art { white-space: normal; min-width: 8rem; max-width: 24rem; }
.rca-tab td.rca-art strong { display: block; font-size: .84rem; line-height: 1.25; }
.rca-tab td.rca-art small { display: block; color: var(--col-text-muted); font-size: .74rem; }
.rca-tab tbody tr:nth-child(even) td { background: #f8fafc; }
.rca-v { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.rca-vuoto .rca-v { font-weight: 400; color: var(--col-text-muted); }
.rca-tab .ric { margin-top: .05rem; }
.rca-azioni { margin: .5rem 0 0; }
/* 1.57.0: riquadri e barre che si toccano (dettaglio dell'ordinato) */
.rie-tocca { cursor: pointer; }
.rie-tocca .rie-val { text-decoration: underline dotted var(--col-primary); text-underline-offset: 4px; text-decoration-thickness: 2px; }
.rie-tocca:hover, .rie-tocca:focus-visible { background: #eaf1fb; outline: none; }
.barra-tocca { cursor: pointer; border-radius: 6px; }
.barra-tocca:hover, .barra-tocca:focus-visible { background: #eaf1fb; outline: none; }
.rca-tab tr.rca-cliccabile { cursor: pointer; }
.rca-tab tr.rca-cliccabile:hover td { background: #eaf1fb; }
.rca-tab tr.rca-cliccabile td.rca-art strong { color: var(--col-primary); }
/* 1.57.2: il cliente da cui si era entrati resta evidenziato; tornando alla pagina, evidenziato quello che aveva aperto la finestra */
.rca-tab tr.rca-sel td { background: #dbe8fb !important; }
.rca-tab tr.rca-sel td:first-child { box-shadow: inset 4px 0 0 var(--col-primary); }
.focus-torna { outline: 3px solid #2a78d6 !important; outline-offset: 2px; border-radius: 6px; transition: outline-color .3s; }
.rca-sotto { display: block; color: var(--col-text-muted); font-size: .74rem; }
/* 1.95.0: come è calcolato (righe per prezzo e costo) e ordini di una riga */
.rcc-tab tr.rcc-escl td.rca-art strong { color: #8a5a00; font-style: italic; }
.rcc-tab tfoot td { border-top: 2px solid #cbd5e1; background: #fff6cf; }
.rcc-tab tfoot td .rca-v { font-weight: 800; }
.rcc-tab small.rcc-doc { display: block; margin-top: .15rem; }   /* 1.134.1: conferma, bolle e fatture della riga */
.rcc-tab td.num { white-space: normal; }
.rcc-tab .rca-v, .rcc-tab .ric { white-space: nowrap; }
.rcc-tab td.num .rca-sotto { white-space: normal; }
.rcc-tab td.rca-art { min-width: 7rem; }
.rca-classi { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .5rem 0 0; }
.rca-classi > span { color: var(--col-text-muted); font-size: .85rem; }
@media print { .rie-tocca .rie-val { text-decoration: none; } }
/* 1.56.7 (Gae): intestazione fissa in tutte le tabelle a video delle statistiche (mese per mese, tempi, righe del ricarico) */
.stat-tab-box { overflow: auto; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); }
.stat-tab-box .stat-tab thead th { position: sticky; top: 0; z-index: 2; background: #eef2f7; box-shadow: inset 0 -1px 0 var(--col-border); }
.rca-box { overflow: auto; max-height: calc(100vh - 150px); max-height: calc(100dvh - 150px); border: 1px solid var(--col-border); border-radius: 8px; }
.rca-tab thead th { position: sticky; top: 0; z-index: 2; background: #eef2f7; box-shadow: inset 0 -1px 0 var(--col-border); }
@media (max-width: 600px) { .rca-tab { font-size: .78rem; } .rca-tab th, .rca-tab td { padding: .3rem .25rem; } .rca-tab td.rca-art { min-width: 7rem; } .rca-tab td.rca-art strong { font-size: .78rem; } }
.rca-piu { margin: .5rem; position: sticky; left: .5rem; }   /* 1.56.8: in fondo alla tabella, dentro il riquadro */
@media print { .ric-tocca { text-decoration: none; } }
.graf { margin: .7rem 0; padding: .5rem .5rem .3rem; background: #fcfcfb; border: 1px solid var(--col-border); border-radius: var(--radius); }
.graf-tit { font-weight: 600; font-size: .92rem; color: #0b0b0b; margin-bottom: .2rem; }
.graf-leg { display: flex; gap: .9rem; font-size: .8rem; color: #52514e; margin: .1rem 0 .2rem; }
.graf-leg-voce { display: inline-flex; align-items: center; gap: .3rem; }
.graf-leg-col { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; }
.graf-svg { display: block; overflow: visible; }
.graf-asse { font-size: 11px; fill: #52514e; font-variant-numeric: tabular-nums; }
.graf-griglia { stroke: #e7e6e2; stroke-width: 1; }
.graf-zero { stroke: #a3a29c; stroke-width: 1; }
.graf-croce { stroke: #52514e; stroke-width: 1; stroke-dasharray: 3 3; }
.graf-tocco { cursor: pointer; }
.graf-tocco.graf-sel { fill: rgba(31, 59, 115, .07); }
.graf-info { font-size: .82rem; color: #0b0b0b; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.barra-riga { margin: .35rem 0; }
.barra-testa { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; }
.barra-nome { min-width: 0; overflow-wrap: anywhere; }
.barra-val { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.barra-sotto { display: block; color: var(--col-text-muted); font-size: .76rem; }
.barra-fondo { height: 8px; background: #eeede9; border-radius: 4px; margin-top: .15rem; overflow: hidden; }
.barra-piena { height: 100%; background: #2a78d6; border-radius: 4px; }
@media print {
  #area-stampa.st-stat { font-size: 9.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #area-stampa.st-stat .rie-griglia { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: .2cm 0; }
  #area-stampa.st-stat .rie-num { border: 1px solid #ccc; border-radius: 4px; padding: 3px 5px; background: #f8fafc; }
  #area-stampa.st-stat .rie-lbl { display: block; font-size: 7.5pt; color: #555; }
  #area-stampa.st-stat .rie-val { display: block; font-weight: 700; font-size: 10.5pt; }
  #area-stampa.st-stat .graf { break-inside: avoid; border: 1px solid #ccc; border-radius: 4px; padding: 4px 6px; margin: .25cm 0; background: #fff; }
  #area-stampa.st-stat .graf-info { display: none; }
  #area-stampa.st-stat .graf-tocco { fill: transparent !important; }
  #area-stampa.st-stat .graf-croce { visibility: hidden; }
  #area-stampa.st-stat .graf.graf-barre { break-inside: auto; }
  #area-stampa.st-stat .stat-sez { font-size: 11pt; margin: .3cm 0 .1cm; color: #1f3b73; }
  #area-stampa.st-stat .stat-cliente strong { font-size: 12pt; }
  #area-stampa.st-stat .stat-cliente small { display: block; }
  #area-stampa.st-stat table { font-size: 8.5pt; }
  #area-stampa.st-stat td, #area-stampa.st-stat th { padding: 2px 4px; }
  #area-stampa.st-stat td.num, #area-stampa.st-stat th.num { text-align: right; }
  #area-stampa.st-stat tr { break-inside: avoid; }
  #area-stampa.st-stat .stat-tot td { font-weight: 700; border-top: 1.5px solid #333; }
  #area-stampa.st-stat .barra-riga { break-inside: avoid; margin: 3px 0; }
}
/* 1.87.1: stampe delle statistiche con tante colonne: A4 orizzontale, intestazioni a capo, importi interi */
@page largo { size: A4 landscape; margin: 1cm; }
@media print {
  #area-stampa.st-stat.st-largo { page: largo; }
  #area-stampa.st-stat th { white-space: normal; vertical-align: bottom; }
  #area-stampa.st-stat td.num { white-space: nowrap; }
  #area-stampa.st-stat.st-fitto table { font-size: 7.2pt; }
  #area-stampa.st-stat.st-fitto td, #area-stampa.st-stat.st-fitto th { padding: 1px 2px; }
}

/* 1.52.0: pagina di emergenza e ripristino da un backup */
.em-main { max-width: 540px; }
.em-elenco .em-voce { text-align: left; margin-top: .5rem; }
.em-main input[type=file], #rip-box input[type=file] { display: block; margin: .4rem 0; max-width: 100%; }
#rip-box .ok-box div { margin: .15rem 0; }
#rip-conferma { margin-top: .6rem; }
#rip-conferma .btn { margin-top: .4rem; }

/* 1.52.2: logo Arteca (vettoriale) nella testata e nella pagina di accesso */
.logo-arteca { display: block; height: 28px; width: auto; flex: 0 0 auto; }
.brand-app { font-weight: 700; padding-left: .55rem; border-left: 1px solid rgba(255,255,255,.35); line-height: 1.1; }
.logo-accesso { display: block; width: min(260px, 78%); height: auto; margin: .2rem auto 1.1rem; }
@media (max-width: 360px) { .logo-arteca { height: 24px; } .brand-app { font-size: .95rem; padding-left: .4rem; } .brand { gap: .4rem; } }
/* 1.57.5: domanda prima di stampa / Excel / PDF delle statistiche (con o senza ricarico) */
.ut-modale-sfondo.ris-sfondo { z-index: 9600; }          /* 1.89.1: anche sopra l'andamento prezzi (9500) */
.ris-modale { max-width: 400px; }
.ris-modale strong { display: block; font-size: 1.05rem; color: var(--col-primary); }
.ris-modale .note { margin: .5rem 0 .8rem; }
.ris-bottoni { display: flex; flex-direction: column; gap: .5rem; }
/* 1.94.0: dettaglio (secondo livello) nei PDF ed Excel */
.ris-det { display: block; font-weight: 600; font-size: .9rem; margin: 0 0 .3rem; }
.ris-det select { display: block; width: 100%; margin-top: .3rem; padding: .45rem; font-size: 1rem; }
.ris-bottoni .btn-small { align-self: center; }
/* 1.58.0: il mese nella tabella «Mese per mese» si tocca (clienti del mese) */
.mese-tocca.rie-tocca { text-decoration: underline dotted var(--col-primary); text-underline-offset: 4px; text-decoration-thickness: 2px; border-radius: 4px; }
/* 1.61.0: allegati delle visite */
.all-box { margin: .2rem 0 .9rem; }
.all-tit { font-weight: 600; margin-bottom: .3rem; }
.all-lista { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .45rem; }
.all-riga { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--col-border); border-radius: 8px; padding: .25rem .35rem; background: #fff; }
.all-riga.all-errore { border-color: #c62828; background: #fdecea; }
.all-apri { flex: 1; min-width: 0; display: flex; align-items: center; gap: .55rem; background: none; border: 0; padding: .3rem .2rem; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.all-apri:focus-visible { outline: 2px solid var(--col-primary); border-radius: 6px; }
.all-apri.all-carica { opacity: .55; cursor: progress; }
.all-ic { font-size: 1.35rem; line-height: 1; }
.all-testo { min-width: 0; display: flex; flex-direction: column; }
.all-testo strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.all-testo small { color: var(--col-text-muted); }
.all-errore .all-testo small { color: #c62828; }
.all-azioni { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.all-vuoto { margin: 0; }
.cv-allegati { font-size: .8rem; color: var(--col-text-muted); white-space: nowrap; }
.ut-modale.all-foto { max-width: 900px; }
.all-foto-az { display: flex; gap: .4rem; }
.all-foto-img { display: block; max-width: 100%; max-height: calc(100dvh - 140px); margin: .6rem auto 0; object-fit: contain; border-radius: 6px; }
/* 1.62.0: riquadro dell'amministratore nel pre-ordine */
.pren-admin { border: 1px dashed #b45309; background: #fff8eb; border-radius: 10px; padding: .6rem .75rem; margin: .6rem 0; }
.pren-admin > strong { display: block; color: #92400e; margin-bottom: .2rem; }
.pren-admin label { display: block; margin: .35rem 0; }
.pren-admin .actions { margin-top: .4rem; }
/* 1.62.2: «non scade mai» accanto alla data di scadenza */
.ub-mai { align-self: end; margin-bottom: .55rem; }

/* 1.64.0: tipi di visita (lista unica, ➕ accanto al Tipo) */
.griglia-2.griglia-tipo { grid-template-columns: 3fr 2fr; }
.tipo-riga { display: flex; gap: .35rem; align-items: center; }
.tipo-riga select { flex: 1 1 auto; min-width: 0; }
.tipo-riga .btn { flex: 0 0 auto; margin-top: .15rem; }
.tipi-nuovo { display: flex; gap: .4rem; margin: .7rem 0 .3rem; }
.tipi-nuovo input { flex: 1 1 auto; min-width: 0; margin: 0; }
.tipi-nuovo .con-mic { flex: 1 1 auto; min-width: 0; }
.tipi-nuovo > .btn { white-space: nowrap; flex: 0 0 auto; }
.tipi-lista { margin-top: .4rem; }
.tipi-voce { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem 0; border-bottom: 1px solid var(--col-border); }
.tipi-sx strong { display: block; }
.tipi-sx small { display: block; color: var(--col-text-muted); }
.pren-nota-riga { display: block; font-size: .8rem; margin: .35rem 0 0; }
.pren-nota-riga input { margin-top: .15rem; padding: .3rem .5rem; font-size: .9rem; }
/* 1.66.0: aiuto prezzo nel pre-ordine */
.pren-prezzo-riga { display: flex; gap: .3rem; align-items: center; }
.pren-prezzo-riga input { flex: 1 1 auto; min-width: 0; }
.pren-aiuto-btn { flex: 0 0 auto; padding: .3rem .45rem; }
.pren-ric { display: block; color: #b91c1c; font-size: .8rem; margin-top: .2rem; }
.pren-ric.pren-ric-allarme { font-weight: 700; }
.pren-costo-su { color: #b45309; }                                  /* 1.110.0: costo medio salito */
.pren-costo-su.pren-ric-allarme { color: #b91c1c; }
.pren-costo-su.pren-sotto-costo { background: #fde2e2; border-radius: 4px; padding: .15rem .35rem; }
.pren-aiuto { border: 1px solid #93c5fd; background: #eff6ff; border-radius: var(--radius); padding: .5rem .6rem; margin: .45rem 0; font-size: .85rem; }
.pren-aiuto-tit { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.pren-aiuto-bottoni { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; align-items: center; }
.pren-aiuto-libero { display: inline-flex; gap: .3rem; align-items: center; }
.pren-aiuto-libero input { width: 5.5rem; margin: 0; padding: .3rem .4rem; }
.pren-aiuto-altri { border-top: 1px dashed #93c5fd; padding-top: .35rem; margin-top: .3rem; }
body.privacy .pren-ric, body.privacy .pren-aiuto, body.privacy .pren-aiuto-btn { display: none !important; }
.pren-freccia { color: #dc2626; }
.pren-campi-conf.pren-campi { grid-template-columns: 5.2rem 1fr 1.5fr; }
.pren-aiuto .btn.pren-scelto { background: #dcfce7; border-color: #16a34a; color: #14532d; font-weight: 700; }
.pre-aggiorna { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .4rem 0; }
.pre-aggiorna .note { margin: 0; }

/* ---- 1.69.0 (Gae): pre-ordine con testata, righe al centro e barra fissa in basso con i tipi riga ---- */
.pren-testa { background: #fff; border: 1px solid var(--col-border); border-radius: var(--radius); padding: .5rem .7rem; margin: .4rem 0; }
.pren-testa-dati { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: .5rem; align-items: end; }
.pren-testa-dati small { display: block; color: var(--col-text-muted); font-size: .75rem; font-weight: 400; }
.pren-testa-dati b { display: block; color: var(--col-primary); font-size: 1rem; }
#pren-consegna-box { margin: 0; font-weight: 600; }
#pren-consegna-box input { width: 100%; margin: .1rem 0 0; padding: .3rem .4rem; font-size: .95rem; }
.pren-testa .pren-tipo { margin: .45rem 0 0; }
.pren-num-riga { flex: 0 0 auto; min-width: 1.6rem; text-align: center; font-weight: 700; color: var(--col-text-muted); font-size: .9rem; }
.pren-riga.pren-riga-nuova { border: 2px solid #16a34a; box-shadow: 0 0 0 3px #dcfce7; }
.pren-inserisci { display: block; width: 100%; background: none; border: 0; color: #2c7be5; font-size: .78rem; padding: .05rem 0 .35rem; cursor: pointer; opacity: .8; }
.pren-inserisci:hover, .pren-inserisci:focus { opacity: 1; text-decoration: underline; }
.pren-piede { position: sticky; bottom: 0; z-index: 30; background: #fff; border-top: 2px solid var(--col-primary); margin: .6rem 0 0; padding: .5rem .2rem calc(.5rem + env(safe-area-inset-bottom)); box-shadow: 0 -6px 16px rgba(15, 23, 42, .08); }
.pren-piede .err { margin: 0 0 .4rem; }
.pren-piede .pren-aggiungi { margin: 0; padding: 0; border: 0; }
.pren-risultati { max-height: 45vh; overflow-y: auto; }
.pren-risultati:empty { display: none; }
.pren-modificato, .pren-ins { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 0 .4rem; font-size: .85rem; }
.pren-modificato[hidden], .pren-ins[hidden] { display: none; }
.pren-modificato span { color: #b45309; font-weight: 700; }
.pren-ins span { color: #2c7be5; font-weight: 600; }
.pren-tipi-riga { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .35rem; margin-top: .45rem; }
.pren-t { border: 1px solid var(--col-border); background: #f8fafc; border-radius: 8px; padding: .3rem .2rem; font-size: .78rem; line-height: 1.15; color: inherit; cursor: pointer; }
.pren-t span { display: block; font-size: 1.05rem; }
.pren-t[hidden] { display: none; }
.pren-t-on { background: var(--col-primary); border-color: var(--col-primary); color: #fff; }
.pren-t-chiudi { border-color: #16a34a; color: #14532d; background: #f0fdf4; font-weight: 600; }
/* 1.74.0 (Gae): pannelli dei tipi riga nella barra in basso, nello stesso posto della ricerca articolo (niente finestre sopra) */
.pren-pannello { max-height: 50vh; overflow-y: auto; overscroll-behavior: contain; padding: 0 .1rem .2rem; }
.pren-pannello[hidden] { display: none; }
.pren-pannello-tit { display: block; color: var(--col-primary); font-size: 1rem; margin: 0 0 .1rem; }
.pren-pannello .pren-sped h2.sez { margin-top: .4rem; }
.pren-note-lista { margin-top: .5rem; }
.pren-nota-riga-n { display: flex; align-items: center; gap: .4rem; margin: .25rem 0; }
.pren-nota-riga-n i { font-style: normal; color: var(--col-text-muted); width: 1.3rem; text-align: right; font-size: .85rem; }
.pren-nota-riga-n input { flex: 1 1 auto; min-width: 0; margin: 0; padding: .35rem .5rem; font-family: Consolas, 'Courier New', monospace; font-size: .95rem; }
.pren-nota-riga-n.oltre input { border-color: #dc2626; background: #fef2f2; }
.pren-nota-car { width: 3rem; text-align: right; font-size: .75rem; color: #16a34a; font-family: Consolas, monospace; }
.pren-nota-car.pieno { color: #dc2626; font-weight: 700; }
.pren-note-conta { margin: .4rem 0; font-size: .85rem; font-weight: 600; }
.pren-foglio-bottoni { display: flex; gap: .5rem; justify-content: flex-end; margin-top: .5rem; }
.st-note { white-space: pre-line; }
.pren-piede .ricerca .hint { display: none; }
.pren-piede .ricerca { margin: 0; }
#pren-consegna-box { min-width: 0; }
#pren-consegna-box input { max-width: 100%; min-width: 0; }
/* 1.70.0: riga descrittiva del pre-ordine (solo testo, 30 caratteri) */
.pren-riga.pren-desc { background: #fffbea; border-color: #f0d264; }
.pren-riga.pren-desc .ord-r1 { align-items: center; gap: .4rem; }
.pren-desc-ico { flex: 1 1 auto; font-size: .85rem; color: #8a6d00; font-weight: 600; }
.pren-desc-testo { display: block; width: 100%; box-sizing: border-box; margin: .3rem 0 0; padding: .35rem .5rem; font-family: Consolas, 'Courier New', monospace; font-size: .95rem; }
.pren-riga.pren-desc .pren-nota-car { flex: 0 0 auto; }
#area-stampa td.st-desc { font-style: italic; }
.pren-t.pren-t-on { background: var(--col-primary); border-color: var(--col-primary); color: #fff; }       /* 1.74.0: anche Chiusura diventa blu quando e' attiva */

/* ---------- 1.75.0 (Gae): testata su una riga e «lavagna» delle righe come la conferma stampata ---------- */
.pren-testa-dati { display: flex; flex-wrap: nowrap; align-items: center; gap: .35rem; font-size: .9rem; white-space: nowrap; }
.pren-testa-dati b { display: inline; color: var(--col-primary); font-size: .95rem; }
.pren-sep { color: var(--col-text-muted); margin: 0 .1rem; }
#pren-consegna-box { display: flex; align-items: center; gap: .3rem; margin: 0; font-weight: 400; min-width: 0; flex: 1 1 auto; }
#pren-consegna-box input { width: auto; min-width: 0; max-width: 9.5rem; flex: 1 1 auto; margin: 0; padding: .2rem .3rem; font-size: .88rem; }
.pren-lavagna { height: 32vh; min-height: 11rem; overflow-y: auto; overscroll-behavior: contain; background: #f3f7fd; border: 1px solid #d6e0ef; border-radius: 8px; margin: .4rem 0; font-size: .8rem; display: flex; flex-direction: column; }
.lv-testa, .lv-riga { display: grid; grid-template-columns: 1.3rem minmax(0, 1fr) 3.3rem 3.3rem 3.9rem 3.6rem; column-gap: .3rem; align-items: start; }
.lv-testa { position: sticky; top: 0; z-index: 2; background: #e6eef9; color: var(--col-primary); font-size: .68rem; font-weight: 700; padding: .3rem .3rem; }
.lv-testa span:nth-child(3), .lv-testa span:nth-child(4), .lv-testa span:nth-child(5) { text-align: right; }
.lv-righe { flex: 1 0 auto; }
.lv-riga { position: relative; padding: .3rem .3rem; border-bottom: 1px solid #dfe6f1; }
/* riga 1: numero, descrizione a tutta larghezza, ✏️ ✕; riga 2: codice/note sotto la descrizione, q.tà / prezzo / importo nelle colonne */
.lv-n { grid-column: 1; grid-row: 1; color: var(--col-text-muted); font-weight: 700; text-align: center; }
/* 1.135.0: dal numero si trascina la riga (js/trascina.js) */
.lv-n.tr-maniglia { grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: center; border-radius: 4px; }
.lv-n.tr-maniglia::after { content: '⠿'; font-size: .85rem; line-height: 1; opacity: .5; }
.lv-n.tr-maniglia:hover { background: #eef2ff; color: #6f42c1; }
.lv-n.tr-maniglia:focus-visible { outline: 2px solid #6f42c1; outline-offset: 1px; }
.lv-art { grid-column: 2 / 6; grid-row: 1; font-size: .8rem; line-height: 1.2; cursor: pointer; overflow-wrap: anywhere; }
.lv-info { grid-column: 2; grid-row: 2; color: var(--col-text-muted); font-size: .68rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-q { grid-column: 3; grid-row: 2; }
.lv-p { grid-column: 4; grid-row: 2; }
.lv-i { grid-column: 5; grid-row: 2; }
.lv-q, .lv-p, .lv-i { text-align: right; white-space: nowrap; }
.lv-az { grid-column: 6; grid-row: 1 / 3; align-self: center; }
.lv-allarme { color: #b91c1c; font-weight: 700; }
/* 1.126.0: «✓ Completato» nel follow-up */
.btn-ok-fu { background: #e5f4e4; border-color: #86c98a; color: #166534; font-weight: 700; }
.fu-completa { margin-top: .4rem; padding: .5rem; border: 1px dashed var(--col-border); border-radius: var(--radius); }
.fu-completa input { width: 100%; margin: .2rem 0 .4rem; }
.fu-avviso { margin: .2rem 0; color: #92400e; font-size: .88rem; }
/* 1.125.0: casella degli ordini nella pagina Utenti */
.ut-email-ordini { margin: .8rem 0; }
.ut-email-ordini-riga { display: flex; gap: .4rem; align-items: center; }
.ut-email-ordini-riga input { flex: 1 1 auto; min-width: 0; margin: 0; }
/* 1.124.0: spedizioniere obbligatorio con il trasporto «Vettore» */
.pren-manca.pren-obbligo { color: #b91c1c; font-weight: 700; }
/* 1.122.0: sotto costo prima della fattura */
.filtro-date { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; margin-top: .3rem; }
.filtro-date input[type=date] { width: auto; min-width: 9.5rem; margin: 0; }
.aum-badge-ord { background: #e7f1fb; color: #1e3a8a; }
.aum-badge-bol { background: #f9eeda; color: #7c4a03; }
.aum-badge-verif { background: #efedff; color: #5b21b6; }
.lv-desc .lv-testo { grid-column: 2 / 6; grid-row: 1; font-style: italic; color: #5b4a00; }
/* 1.120.0: B davanti alle righe descrittive (va anche su bolle e fatture) */
.pren-nota-riga-n input.pren-nota-flag { flex: 0 0 2rem; width: 2rem; text-align: center; font-weight: 700; text-transform: uppercase; padding-left: 0; padding-right: 0; }
.lv-pre { display: inline-block; font-style: normal; background: #5b4a00; color: #fff; border-radius: 4px; padding: 0 .3rem; margin-right: .35rem; font-size: .8em; }
.lv-az { display: flex; justify-content: flex-end; gap: .15rem; }
.pren-tipo { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.pren-testa .pren-tipo .btn { padding: .2rem .6rem; }
.lv-bt { border: 1px solid var(--col-border); background: #fff; border-radius: 6px; width: 1.65rem; height: 1.65rem; padding: 0; font-size: .78rem; line-height: 1; cursor: pointer; }
.lv-bt.lv-ins { position: absolute; left: 50%; bottom: -.55rem; transform: translateX(-50%); width: 1.1rem; height: 1.1rem; border-radius: 50%; font-size: .7rem; color: #2c7be5; z-index: 1; opacity: .85; }
.lv-lucchetto { font-size: .8rem; }
.lv-riga.lv-in-modifica { background: #fff6cf; }
.lv-riga.lv-agg { border-left: 3px solid #f59e0b; }
.lv-riga.pren-riga-nuova { background: #dcfce7; transition: background .4s; }
.lv-vuota { color: var(--col-text-muted); text-align: center; margin: 1.2rem .5rem; }
.lv-tot { position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: .5rem; padding: .35rem .5rem; background: #e6eef9; border-top: 2px solid #c9d6ea; color: var(--col-primary); font-weight: 700; font-size: .82rem; }
.pren-art-edit { padding: .1rem 0 .2rem; }
.pren-art-edit[hidden] { display: none; }
.pren-ed-tit { font-size: .88rem; margin-bottom: .1rem; }
.pren-ed-tit strong { color: var(--col-primary); }
.pren-art-edit .pren-campi { margin-top: .3rem; }
/* spazio fisso per i pannelli: non cambia altezza passando da un tasto all'altro (la pagina non «balla») */
.pren-stato-riga { height: 2.3rem; display: flex; align-items: center; gap: .4rem; overflow: hidden; }
.pren-stato-riga > * { margin: 0 !important; flex: 1 1 auto; min-width: 0; }
.pren-stato-riga .err { font-size: .78rem; line-height: 1.15; max-height: 2.3rem; overflow-y: auto; padding: .15rem .4rem; }
.pren-stato-riga .pren-modificato, .pren-stato-riga .pren-ins { padding: .2rem .4rem; }
.pren-pannelli { height: 36vh; min-height: 14rem; position: relative; }
.pren-pannelli > .pren-aggiungi, .pren-pannelli > .pren-pannello { height: 100%; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
#pren-art-cerca { min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
#pren-art-cerca[hidden] { display: none; }
#pren-art-cerca .pren-risultati { max-height: none; flex: 0 1 auto; overflow-y: auto; }

/* ---------- 1.75.1 (Gae): barra in basso compatta: la lavagna guadagna spazio ---------- */
.pren-piede { padding: .25rem .2rem calc(.3rem + env(safe-area-inset-bottom)); }
.pren-stato-riga { height: 1.6rem; }
.pren-stato-riga .err { font-size: .7rem; line-height: 1.1; max-height: 1.6rem; padding: .05rem .4rem; }
.pren-stato-riga .pren-modificato, .pren-stato-riga .pren-ins { padding: 0 .3rem; font-size: .78rem; }
.pren-stato-riga .btn-small { padding: .1rem .55rem; font-size: .78rem; }
.pren-pannelli { height: clamp(11.5rem, 24vh, 17rem); min-height: 0; }
.pren-pannello-tit { font-size: .85rem; }
.pren-pannello > small.note { display: block; font-size: .7rem; line-height: 1.2; margin: 0 0 .15rem; }
/* tasti su una riga: icona e testo affiancati */
.pren-tipi-riga { margin-top: .25rem; gap: .25rem; }
.pren-t { display: flex; align-items: center; justify-content: center; gap: .2rem; padding: .3rem .1rem; font-size: .72rem; white-space: nowrap; line-height: 1; }
.pren-t span { display: inline; font-size: .85rem; }
/* campi bassi (30 px); il testo resta a 16 px: sotto l'iPhone ingrandisce la pagina quando si tocca un campo */
.pren-art-edit label, .pren-pannello label { font-size: .68rem; margin: 0; color: #4b5563; }
.pren-art-edit input, .pren-art-edit select, .pren-pannello input:not([type=checkbox]), .pren-pannello select { height: 1.9rem; padding: .1rem .4rem; font-size: 16px; margin: .05rem 0 0; }
.pren-ed-tit { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .82rem; margin: 0; }
.pren-ed-tit .pren-art { font-weight: 700; padding: 0; }
.pren-ed-tit small { color: var(--col-text-muted); font-size: .7rem; }
.pren-art-edit .pren-campi { display: flex; gap: .3rem; align-items: flex-end; margin: .1rem 0 0; }
.pren-art-edit .pren-campi > label { flex: 1 1 0; min-width: 0; }
.pren-art-edit .pren-campi > .pren-ed-un { flex: 0 0 5rem; }
.pren-art-edit .pren-prezzo-riga { display: flex; gap: .25rem; }
.pren-art-edit .pren-prezzo-riga input { flex: 1 1 auto; min-width: 0; }
.pren-art-edit .pren-aiuto-btn { height: 1.9rem; padding: 0 .4rem; flex: 0 0 auto; }
.pren-ed-r2 { display: flex; gap: .3rem; margin-top: .15rem; }
.pren-ed-r2 > label { flex: 1.6 1 0; min-width: 0; }
.pren-ed-r2 > .pren-cons { flex: 1 1 0; display: block; }
.pren-ed-r2 .pren-cons small { display: none; }
.pren-ed-r2 .pren-cons input { width: 100%; }
.pren-ed-fondo { display: flex; align-items: center; gap: .3rem; margin-top: .25rem; }
.pren-ed-avvisi { flex: 1 1 auto; min-width: 0; font-size: .7rem; line-height: 1.2; }
.pren-ed-avvisi small { display: block; font-size: .7rem; margin: 0; }
.pren-ed-avvisi .pren-nota-prezzo { color: var(--col-text-muted); }
.pren-ed-err { color: #b91c1c; font-weight: 700; }
.pren-ed-fondo .btn { padding: .3rem .7rem; font-size: .85rem; flex: 0 0 auto; }
.pren-art-edit .pren-aiuto { margin: .2rem 0; font-size: .8rem; }
/* ricerca: campo da 34 px */
#pren-art-cerca input[type=search] { height: 2.15rem; padding: .2rem .5rem; font-size: 16px; }
/* note e descrittive: righe basse */
.pren-nota-riga-n { margin: .1rem 0; }
.pren-nota-riga-n input { height: 1.8rem; padding: .1rem .4rem; }
.pren-note-conta { font-size: .72rem; margin: .1rem 0; }
.pren-foglio-bottoni { margin-top: .2rem; }
.pren-foglio-bottoni .btn { padding: .3rem .8rem; font-size: .85rem; }
.pren-ed-tit .pren-art { display: inline; width: auto; text-align: left; background: none; border: 0; color: var(--col-primary); text-decoration: underline; }

/* ---------- 1.77.0 / 1.22.0 (Gae): filtri della ricerca articolo compatti nella barra in basso ---------- */
.pren-piede .ricerca { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .3rem; margin: 0; }
.pren-piede .ricerca-riga { flex: 1 1 calc(100% - 3.6rem); min-width: 0; gap: .25rem; margin: 0; }
.pren-piede .ricerca-campo { height: 1.95rem; padding: 0 .2rem; font-size: 16px; max-width: 30%; border-radius: 6px; }
.pren-piede .ricerca-riga > .con-mic { gap: .25rem; align-items: center; }
.pren-piede .ricerca-riga > .con-mic input { height: 1.95rem; padding: .1rem .45rem; font-size: 16px; }
.pren-piede .rc-aiuto, .pren-piede .btn-mic { width: 1.95rem; height: 1.95rem; min-width: 0; margin: 0 !important; padding: 0; font-size: .85rem; flex: 0 0 auto; align-self: center; }
.pren-piede .ricerca-piu { flex: 0 0 auto; margin: 0; font-size: .72rem; }
.pren-piede .ricerca .hint { display: none; }
.pren-piede .btn-x { width: 1.6rem; height: 1.6rem; padding: 0; font-size: .75rem; }
.pren-piede .rc-chip-box { margin: .1rem 0; gap: .2rem; }
.pren-piede .rc-chip { font-size: .72rem; padding: .05rem .4rem; }
.pren-piede .rc-barra { gap: .3rem; padding: .15rem 0; }
.pren-piede .rc-voce { font-size: .72rem; padding: .1rem .45rem; }
.pren-piede .rc-tit { font-size: .62rem; }
.pren-pannelli { height: clamp(10.3rem, 20vh, 15rem); }      /* 1.77.0: dopo la ricerca compatta basta lo spazio dell'editor articolo */
/* 1.77.0: la data di consegna in testata si vede intera (gg/mm/aaaa) anche sul telefono */
.pren-testa-dati { gap: .2rem; font-size: .86rem; }
.pren-sep { margin: 0; }
#pren-consegna-box { gap: .2rem; }
#pren-consegna-box input { flex: 0 1 7.4rem; min-width: 6.9rem; padding: .15rem .15rem; font-size: .84rem; }

/* 1.78.0 (Gae): nota di riga su una riga sua (sotto codice e q.tà), grassetto scuro; tocco o mouse sopra = si legge intera */
.lv-nota { grid-column: 2 / 6; grid-row: 3; color: #111827; font-weight: 700; font-size: .76rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.lv-nota.lv-aperta { white-space: normal; overflow-wrap: anywhere; }

/* 1.79.0 (Gae): 🎨 colori sulle parole: bottone accanto al contatore delle note e accanto alla nota della riga */
.pren-note-piede { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pren-nota-campo { display: flex; align-items: center; gap: .3rem; margin-top: .15rem; }
.pren-nota-campo input { flex: 1 1 auto; min-width: 0; margin-top: 0; }
#area-stampa .st-nota { font-weight: 700; }
/* 1.79.0: nei pannelli Note / N. int. / Descr. i bottoni (🎨 Annulla ✓) restano sempre in vista in fondo, anche con molte righe */
.pren-pannello .pren-foglio-bottoni { position: sticky; bottom: 0; z-index: 1; background: #fff; padding: .2rem 0 .1rem; }

/* 1.80.0 (Gae): 📄 PDF in fondo alla barra dei tasti, stretto (solo il simbolo) */
.pren-tipi-riga { display: flex; }
.pren-tipi-riga > .pren-t { flex: 1 1 0; min-width: 0; }
.pren-tipi-riga > .pren-t-pdf { flex: 0 0 2.3rem; }
.pren-tipi-riga > .pren-t[hidden] { display: none; }
.pren-tipi-riga { gap: .2rem; }
.pren-tipi-riga > .pren-t { gap: .12rem; padding: .3rem 0; font-size: .66rem; }
.pren-tipi-riga > .pren-t span { font-size: .78rem; }
.pren-tipi-riga > .pren-t-pdf { flex-basis: 2rem; }
.pren-tipi-riga > .pren-t-pdf span { font-size: .95rem; }
.pren-tipi-riga > .pren-t { flex: 1 1 auto; }          /* larghezza secondo la scritta: «Chiusura» e «Articolo» prendono di piu' */
.pren-tipi-riga > .pren-t-pdf { flex: 0 0 2rem; }
@media (max-width: 380px) { .pren-tipi-riga > .pren-t:not(.pren-t-pdf) span { display: none; } }   /* telefoni stretti: solo le scritte */

/* 1.81.0 (Gae): ✏️ ▲ dell'aiuto prezzo per tutti o per articolo, con chi e quando */
.pren-aiuto-tit-bt { display: inline-flex; gap: .3rem; }
.pren-ap-fonte { margin-top: .3rem; font-size: .78rem; display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .4rem; }
.pren-ap-fonte > span:first-child { font-weight: 700; color: #1e3a8a; }
.pren-ap-mod { margin-top: .3rem; }
.pren-ap-riga { display: flex; align-items: center; gap: .3rem; margin: .2rem 0; }
.pren-ap-riga input { margin: 0; padding: .25rem .35rem; height: 1.9rem; font-size: 16px; }
.pren-ap-riga input:first-of-type { width: 4.2rem; }
.pren-ap-riga input:last-of-type { width: 6rem; }
.pren-ap-n { color: #15803d; font-weight: 700; }
.pren-ap-dove { display: flex; flex-wrap: wrap; gap: .2rem .9rem; margin: .35rem 0 .1rem; font-size: .82rem; }
.pren-ap-dove label { display: inline-flex; align-items: center; gap: .25rem; margin: 0; font-size: .82rem; color: inherit; }
.pren-ap-dove input { margin: 0; width: auto; height: auto; }
.pren-ap-err { color: #b91c1c; font-size: .8rem; font-weight: 600; }
.pren-ap-bt { justify-content: flex-end; }
.pren-ap-riga { flex-wrap: nowrap; }
.pren-ap-riga .note { display: inline; margin: 0; white-space: nowrap; }
.pren-ap-riga input:last-of-type { width: 5.4rem; }

/* 1.83.0 (Gae): ricerca clienti per il nuovo pre-ordine; avviso «cliente a debito» toccabile */
.cli-per-pre { margin: 0 0 .5rem; }
.pren-esp { cursor: pointer; }
.pren-esp-vai { font-weight: 700; white-space: nowrap; }
.cli-per-pre { display: block; padding: .5rem .7rem; border-radius: 8px; font-size: .9rem; border: 1px solid #bfdbfe; }

/* 1.84.0 (Gae): risultati della ricerca articolo sopra la lavagna, dal primo in alto (spariscono scelto l'articolo) */
#pren-art-cerca .pren-risultati { position: absolute; left: 0; right: 0; bottom: 100%; z-index: 35; margin: 0 0 .15rem; max-height: 50vh; overflow-y: auto;
  background: #fff; border: 1px solid #93c5fd; border-radius: 8px; box-shadow: 0 -6px 18px rgba(15, 23, 42, .18); }

/* 1.86.0 (Gae): margine € nelle statistiche e «Chi pesa davvero» */
.ric-mg { display: block; }
.ric-mg .ric-fr { color: #15803d; }
.stat-pesa { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .6rem; margin: .4rem 0 .8rem; }
.stat-pesa-col { border: 1px solid var(--col-border); border-radius: 10px; padding: .55rem .65rem; background: #fff; display: flex; flex-direction: column; gap: .3rem; }
.stat-pesa-poco { border-left: 4px solid #dc2626; }
.stat-pesa-colt { border-left: 4px solid #15803d; }
.stat-pesa-voce { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; padding: .35rem .4rem; border: 0; border-top: 1px solid #eef1f5; background: none; font: inherit; color: inherit; cursor: pointer; }
.stat-pesa-voce small { color: var(--col-text-muted); }
.stat-pesa-nome { font-weight: 700; }

/* 1.89.0: 📈 andamento prezzi dal pre-ordine (finestra) */
.pren-and-sfondo { z-index: 9500; padding: 8px; }
.ut-modale.pren-and { width: min(680px, calc(100vw - 16px)); max-width: none; max-height: calc(100dvh - 24px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.pren-and .ut-modale-testa { padding: .55rem .7rem; border-bottom: 1px solid #e5e7eb; }
.pren-and .ut-modale-testa small { display: block; color: var(--col-text-muted); font-size: .78rem; font-weight: 400; }
.pren-and-corpo { overflow-y: auto; padding: .5rem .7rem .8rem; -webkit-overflow-scrolling: touch; }
.pren-and-sopra { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .4rem; margin-bottom: .3rem; }
.pren-and-box { border: 1px solid #e5e7eb; border-radius: 8px; background: #f8fafc; padding: .35rem .5rem; }
.pren-and-box strong { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.pren-and-box small { display: block; font-size: .76rem; color: var(--col-text-muted); }
.pren-and-lbl { display: block; font-size: .74rem; color: var(--col-text-muted); }
.pren-and-sez { font-size: .95rem; color: var(--col-primary); margin: .8rem 0 .1rem; }
.pren-and .note { font-size: .78rem; margin: .1rem 0 .3rem; }
.pren-and-tab { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
.pren-and-tab th { text-align: left; font-size: .72rem; font-weight: 600; color: var(--col-text-muted); border-bottom: 1px solid #d1d5db; padding: .2rem .25rem; white-space: nowrap; }
.pren-and-tab td { border-bottom: 1px solid #eef0f3; padding: .25rem .25rem; vertical-align: top; }
.pren-and-tab .num { text-align: right; white-space: nowrap; }
.pren-and-tab td small { display: block; font-size: .72rem; color: var(--col-text-muted); white-space: normal; }
.pren-and-tab tbody tr:first-child td { font-weight: 600; }
.pren-and-ric { white-space: nowrap; }
.pren-and-su { color: #15803d; }
.pren-and-giu { color: #b91c1c; }
.pren-and-piu { margin-top: .35rem; }
.pren-and-azioni { margin: 0 0 .4rem; }

/* 1.97.0: scadenziario e incassi */
.fin-bollino { display: inline-block; margin: .2rem 0 0; padding: .05rem .45rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; width: max-content; }
.fin-critico { background: #fde2e1; color: #a61b1b; }
.fin-alto { background: #ffe9d1; color: #a04f00; }
.fin-medio { background: #fff4c2; color: #7a5b00; }
.fin-basso { background: #e3f4e8; color: #1f6b3a; }
.stat-cliente .fin-bollino { margin-left: .4rem; }
.graf-info .graf-apri { margin-left: .3rem; padding: .1rem .5rem; font-size: .8rem; }
.esp-scad { margin: .5rem 0 .2rem; font-size: .9rem; line-height: 1.4; }
.esp-scad.esp-debito strong { color: #b42318; }
.esp-scad-vai { margin: .3rem 0 .4rem; }
.pren-esp-scad { font-weight: 600; }
.stat-azioni.fin-azioni { flex-wrap: wrap; justify-content: flex-end; row-gap: .4rem; }
.stat-azioni.fin-azioni .btn { white-space: nowrap; }
/* 1.98.0: fatture */
.fin-fatture { display: flex; flex-direction: column; gap: .35rem; margin: .3rem 0 .6rem; }
.fin-fattura { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .6rem; }
.fin-fattura small { color: var(--col-text-muted); }
.fin-fatt .pdf-link { white-space: nowrap; }

/* 1.99.0: avviso del follow-up nella visita */
.visita-avviso { border: 1px solid var(--col-border); border-radius: var(--radius); padding: 8px 10px; margin: 4px 0 10px; background: var(--col-bg); }
.visita-avviso label { margin-bottom: 6px; }
.visita-avviso .avv-quando { display: block; color: var(--col-text-muted); line-height: 1.35; }

/* 1.100.0 (Gae): aiuto prezzo SOPRA il campo prezzo (sovrapposto alla lavagna: niente da scorrere) */
.pren-pannelli .pren-aiuto.pren-aiuto-sopra { position: absolute; left: 0; right: 0; z-index: 36; margin: 0; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 -6px 18px rgba(15, 23, 42, .22); }
.pren-pannelli .pren-aiuto.pren-aiuto-sopra[hidden] { display: none; }
/* scheda di magazzino in finestra dal codice della riga */
.pren-art-edit .pren-mag-btn { height: 1.6rem; padding: 0 .3rem; margin-right: .25rem; font-size: .8rem; vertical-align: middle; }
.ut-modale.mag-veloce { width: min(460px, calc(100vw - 16px)); }
.mag-veloce-corpo { padding: .2rem .1rem .1rem; }
.mag-veloce-testa { display: flex; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.mag-veloce-testa strong { display: block; line-height: 1.25; }
.mag-veloce-testa small { color: var(--col-text-muted); }
.mag-veloce-num { margin: .3rem 0 .5rem; }
.mag-veloce-sez { font-weight: 700; font-size: .85rem; margin: .4rem 0 .2rem; }
.mag-veloce-nota { font-size: .78rem; margin: .5rem 0; }
.mag-veloce-bt { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: space-between; margin-top: .4rem; }

/* 1.101.0: barra dei tipi riga con Rif. ord. e Bordereau, sempre su una riga sola */
.pren-tipi-riga { grid-auto-columns: minmax(0, 1fr); }
.pren-t { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) {
  .pren-tipi-riga { gap: .15rem; }
  .pren-t { flex-direction: column; gap: .05rem; font-size: .6rem; padding: .22rem 0; letter-spacing: -.01em; }
  .pren-t span { font-size: .95rem; }
}
/* in testa alla lavagna: memo, riferimento ordine, bordereau */
.lv-testa-dati { display: flex; flex-wrap: wrap; gap: .1rem .8rem; padding: .2rem .45rem; border-bottom: 1px dashed #c7d2e3; font-size: .74rem; color: #1e3a5f; }
.lv-testa-dati[hidden] { display: none; }
/* conferma al cliente Si' / No e email salvate */
.pren-conf-sn { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .9rem; margin: .2rem 0 .3rem; font-size: .85rem; }
.pren-conf-sn label.radio { display: inline-flex; align-items: center; gap: .25rem; margin: 0; font-size: .85rem; }
#pren-email-si[hidden] { display: none; }
.pren-email-scelte { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0; }
.pren-email-voce { display: inline-flex; align-items: center; }
.pren-email-chip { border: 1px solid #93c5fd; background: #fff; color: #1e3a8a; border-radius: 999px; padding: .2rem .6rem; font-size: .78rem; cursor: pointer; }
.pren-email-chip.su { background: #dbeafe; font-weight: 600; }
.pren-email-chip small { color: #64748b; font-weight: 400; }
.pren-email-togli { border: 0; background: none; color: #b91c1c; cursor: pointer; padding: 0 .3rem; font-size: .8rem; }
.pren-memo { display: block; margin-top: .3rem; }
.utente-memo { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; }
.utente-memo input { width: 9rem; margin: 0; }

/* 1.101.0 / portale 1.34.0 (Gae): maniglia sotto la lavagna per allungarla o accorciarla (js/utility.js allungabile) */
.ut-maniglia { display: flex; align-items: center; justify-content: center; height: 16px; margin: -.35rem 0 .15rem; cursor: ns-resize; touch-action: none; user-select: none; -webkit-user-select: none; }
.ut-maniglia::before { content: ''; width: 3.4rem; height: 5px; border-radius: 3px; background: #b6c2d4; }
.ut-maniglia:hover::before, .ut-maniglia:focus-visible::before, .ut-maniglia.ut-maniglia-su::before { background: #2563eb; }
.ut-maniglia:focus { outline: none; }

/* 1.102.0: Collegati e messaggi (amministratori) */
.cl-colonne { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
@media (max-width: 760px) { .cl-colonne { grid-template-columns: 1fr; } }
.cl-box { background: var(--col-surface); border: 1px solid var(--col-border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.cl-tit { font-size: 1rem; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.cl-num { background: var(--col-primary); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: .95rem; }
.cl-lista { max-height: 320px; overflow: auto; }
.cl-riga { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--col-border); }
.cl-riga:first-child { border-top: 0; }
.cl-chi { min-width: 0; }
.cl-chi strong, .cl-chi small { display: block; overflow-wrap: anywhere; }
.cl-chi strong::before { content: '● '; color: var(--col-ok); }
.cl-chi small { color: var(--col-text-muted); }
.cl-scrivi { background: var(--col-surface); border: 1px solid var(--col-border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; }
.cl-scelta { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.cl-scelta label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cl-dest, .cl-scrivi textarea { width: 100%; box-sizing: border-box; }
.cl-manda-riga { gap: 10px; align-items: center; }
.cl-storico { display: grid; gap: 6px; }
.cl-msg { background: var(--col-surface); border: 1px solid var(--col-border); border-radius: 10px; overflow: hidden; }
.cl-msg-testa { display: flex; width: 100%; gap: 10px; align-items: flex-start; justify-content: space-between; background: none; border: 0; padding: 8px 12px; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.cl-msg-info { min-width: 0; display: grid; }
.cl-msg-info small { color: var(--col-text-muted); }
.cl-msg-testo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--col-text); }
.cl-letti { flex: none; font-size: .85rem; padding: 2px 8px; border-radius: 999px; background: #fff3cd; color: #7a5b00; white-space: nowrap; }
.cl-letti-tutti { background: #d1fae5; color: #065f46; }
.cl-msg-det { border-top: 1px solid var(--col-border); padding: 8px 12px; }
.cl-msg-pieno { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--col-bg); border-left: 3px solid #6f42c1; padding: 6px 10px; margin: 0 0 8px; }
.cl-dest-riga { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px dashed var(--col-border); }
.cl-dest-riga small { color: var(--col-text-muted); }
.cl-quando { flex: none; font-size: .85rem; color: #7a5b00; }
.cl-letto .cl-quando { color: var(--col-ok); }

/* 1.104.0: ⏰ rimanda l'avviso dal Follow-up */
.fu-rimanda { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; margin-top: 6px; padding: 8px; border: 1px dashed var(--col-border); border-radius: 8px; }
.fu-rimanda input[type=datetime-local] { min-width: 0; }
.fu-rimandato { display: block; color: #7a5b00; margin-top: 4px; }

/* ---------- 1.105.2 (Gae): tasti della barra del pre-ordine con colori pastello tenui, uno per tasto (come nel portale); quello aperto resta blu ---------- */
#pren-t-articolo { background: #eaf2fd; border-color: #bcd4f3; }
#pren-t-rif      { background: #f2edfb; border-color: #d4c7ee; }
#pren-t-desc     { background: #fdf1e7; border-color: #f0d2b6; }
#pren-t-note     { background: #fdf9e1; border-color: #eadf9f; }
#pren-t-interne  { background: #fbecef; border-color: #ecc3cc; }
#pren-t-bord     { background: #e6f6f4; border-color: #b2dfd8; }
#pren-t-chiusura { background: #eaf7ee; border-color: #8fcda2; color: #14532d; }
#pren-t-pdf      { background: #f1f3f5; border-color: #cfd5db; }
.pren-tipi-riga > .pren-t:hover { filter: brightness(.97); }
.pren-tipi-riga > .pren-t.pren-t-on { background: var(--col-primary) !important; border-color: var(--col-primary) !important; color: #fff !important; filter: none; }   /* vince sui colori per id */
/* 1.106.1 (Gae): ＋ anche in cima, sopra la prima riga */
.lv-cima { display: flex; justify-content: center; height: .85rem; align-items: center; }
.lv-cima .lv-bt.lv-ins.lv-ins-su { position: static; transform: none; }
.lv-cima .lv-bt.lv-ins.lv-ins-su::before { content: '＋'; }      /* simbolo dal CSS: la striscia resta fuori da «Esporta in Excel» */
/* 1.107.0: spazio del database e dei file (Database del server) */
.db-spazio { margin: .6rem 0; padding: .5rem .6rem; border: 1px solid var(--col-border); border-radius: 8px; }
.db-spazio h3 { margin: 0 0 .35rem; font-size: 1rem; }
.db-spazio-barra { height: .55rem; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: .3rem 0 .5rem; }
.db-spazio-barra span { display: block; height: 100%; background: #16a34a; }
.db-spazio-barra span.pieno { background: #dc2626; }
.db-spazio-quota { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .88rem; margin-bottom: .4rem; }
.db-spazio-quota input { width: 6.5rem; }
.db-spazio-file { width: 100%; border-collapse: collapse; font-size: .85rem; margin: .3rem 0; }
.db-spazio-file td { padding: .15rem .3rem; border-bottom: 1px solid #eef0f3; }
.db-spazio-file td:nth-child(2), .db-spazio-file td:nth-child(3) { text-align: right; white-space: nowrap; }
.db-spazio-file tr.tot td { font-weight: 600; border-bottom: 0; }
.db-spazio .nota { font-size: .8rem; color: #6b7280; display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* 1.111.0: «Costi saliti, prezzi fermi» piu' chiaro e andamento costi per famiglia */
.rie-perdita .rie-val { color: #c62828; }
.aum-voce { align-items: flex-start; border-left: 4px solid #e0a106; }
.aum-voce.aum-perdita { border-left-color: #c62828; background: #fff6f6; }
.aum-testa { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.aum-badge { font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; white-space: nowrap; }
.aum-badge-perdita { background: #fde2e2; color: #a61b1b; }
.aum-badge-ridotto { background: #fff1d6; color: #8a5300; }
.aum-art { display: block; color: var(--col-muted, #555); font-size: .85rem; margin: .15rem 0 .35rem; }
.aum-griglia { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .4rem .8rem; margin: .1rem 0 .35rem; }
.aum-cella { display: flex; flex-direction: column; min-width: 0; }
.aum-cella small { color: var(--col-muted, #555); font-size: .75rem; }
.aum-cella b { font-size: 1rem; }
.aum-cella.aum-su b { color: #b45309; }
.aum-cella.aum-neg b { color: #c62828; }
.aum-frase { display: block; color: #333; }
.aum-dx { display: flex; flex-direction: column; align-items: flex-end; color: #c62828; }
.aum-dx small { color: var(--col-muted, #555); font-weight: 400; }
@media (max-width: 600px) { .aum-griglia { grid-template-columns: 1fr 1fr; } .aum-griglia .aum-cella:last-child { grid-column: 1 / -1; } }
.fam-var { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .3rem; }
.fam-var > span { display: flex; flex-direction: column; }
.fam-var small { color: var(--col-muted, #555); font-size: .72rem; }
.fam-su { color: #c62828; }
.fam-giu { color: #1b7f3b; }
.mat-lista { display: flex; flex-direction: column; gap: .4rem; margin: .6rem 0; }
.mat-riga { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr auto auto; gap: .4rem; align-items: center; }
.mat-riga input { width: 100%; }
.mat-riga small { color: var(--col-muted, #555); white-space: nowrap; }
.mat-bt { display: flex; gap: .25rem; }
@media (max-width: 600px) { .mat-riga { grid-template-columns: 1fr auto; } .mat-riga input:nth-child(2) { grid-column: 1 / -1; } }

/* 1.112.0 (Gae): i numeri negativi sempre in rosso (js/negativi.js) */
.neg { color: #c62828 !important; }
@media print { .neg { color: #c62828 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* 1.112.0: percentuale libera nelle scelte delle soglie */
.filtro-libera { display: flex; align-items: center; gap: .3rem; margin-top: .3rem; }
.filtro-libera[hidden] { display: none; }
.filtro-libera input { width: 6rem; }
/* 1.112.0: proposta aumenti per cliente */
.prop-voce { align-items: flex-start; }
.prop-dx { display: flex; flex-direction: column; align-items: flex-end; color: #1b7f3b; }
.prop-dx small { color: var(--col-muted, #555); font-weight: 400; }
.aum-cella.prop-nuovo b { color: #1b7f3b; }
.prop-cliente { align-items: center; flex-wrap: wrap; }
/* 1.113.0: piano aumenti per famiglia */
.piano-lista { display: flex; flex-direction: column; gap: .3rem; margin: .4rem 0 .6rem; }
.piano-riga { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; padding: .45rem .6rem; border: 1px solid var(--col-border, #dde3ea); border-radius: 8px; background: #fff; }
.piano-riga.piano-con { border-color: #2a78d6; background: #f3f8ff; }
.piano-nome { display: flex; flex-direction: column; min-width: 12rem; flex: 1 1 16rem; }
.piano-nome small { color: var(--col-muted, #555); }
.piano-campo { display: flex; align-items: center; gap: .35rem; }
.piano-campo input { width: 5.5rem; }
.piano-campo input[hidden] { display: none; }
.piano-cerca { width: 100%; max-width: 24rem; margin: .3rem 0; }
.piano-azioni { position: sticky; bottom: 0; background: var(--col-bg, #fff); padding: .5rem 0; }
.aum-voce.aum-piano { border-left-color: #2a78d6; }
/* 1.114.0: clienti esclusi */
.esc-riga { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem .6rem; border: 1px solid var(--col-border, #dde3ea); border-radius: 8px; margin: .3rem 0; background: #fff; }
.esc-testo { display: flex; flex-direction: column; min-width: 0; }
.esc-testo small { color: var(--col-muted, #555); }
.esc-cerca { display: flex; gap: .4rem; margin: .4rem 0; }
.esc-cerca input { flex: 1; }
.btn-danger-outline { border-color: #c62828; color: #c62828; }
/* 1.115.0: filtro con uno o più clienti nelle statistiche; soglie per famiglia (stesso editor del piano) */
.filtro-clienti-btn { width: 100%; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filtro-clienti-pannello { border: 1px solid #2a78d6; border-radius: 8px; background: #f7faff; padding: .5rem .6rem; margin: 0 0 .6rem; display: flex; flex-direction: column; gap: .4rem; }
.filtro-clienti-pannello input[type=search] { width: 100%; }
.filtro-clienti-scelti { display: flex; flex-wrap: wrap; gap: .3rem; }
.filtro-chip { border: 1px solid #2a78d6; background: #fff; color: #1d5fae; border-radius: 999px; padding: .15rem .55rem; font-size: .85rem; cursor: pointer; }
.filtro-clienti-lista { display: flex; flex-direction: column; max-height: 18rem; overflow-y: auto; }
.filtro-clienti-voce { display: flex; align-items: center; gap: .45rem; padding: .3rem .2rem; border-bottom: 1px solid var(--col-border, #e5e9ef); margin: 0; font-weight: 400; cursor: pointer; }
.filtro-clienti-voce input { width: auto; margin: 0; }
.piano-perc[hidden] { display: none; }
@media print { .filtro-clienti-pannello { display: none; } }
/* 1.116.0: proposta aumenti, % a mano per cliente e spunta per la lettera; pagina delle lettere */
.prop-riga { border: 1px solid transparent; border-radius: 10px; margin-bottom: .35rem; }
.prop-riga .stat-voce { margin-bottom: 0; }
.prop-riga.prop-mano { border-color: #2a78d6; background: #f3f8ff; }
.prop-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; padding: .3rem .6rem .45rem; }
.prop-ctrl label { display: flex; align-items: center; gap: .3rem; margin: 0; font-weight: 400; }
.prop-ctrl input[type=checkbox] { width: auto; margin: 0; }
.prop-ctrl input[type=text] { width: 4.5rem; text-align: right; }
.prop-ctrl .note { margin: 0; }
.prop-lettere { align-items: center; flex-wrap: wrap; justify-content: flex-start; position: sticky; top: 0; z-index: 2; background: var(--col-bg, #fff); padding: .35rem 0; }
.lettera-form { display: flex; flex-direction: column; gap: .55rem; max-width: 46rem; }
.lettera-form label { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.lettera-form textarea { width: 100%; font: inherit; }
.lettera-form input[type=date] { max-width: 12rem; }
@media print { .prop-ctrl, .prop-lettere { display: none; } }
/* 1.118.0: da dove viene il costo (movimenti di magazzino); articoli «da verificare» */
.aum-badge-verif { background: #ede7f6; color: #5b2c8f; }
.aum-voce.aum-verif { border-left-color: #7e57c2; }
.aum-avviso { display: block; color: #5b2c8f; font-weight: 600; margin-top: .25rem; }
.aum-riga { margin-bottom: .35rem; }
.aum-riga .stat-voce { margin-bottom: 0; }
.aum-riga-bar { display: flex; justify-content: flex-end; padding: .15rem .3rem .35rem; }
.aum-nota-costo { background: #f4f8fd; border-left: 3px solid #2a78d6; padding: .4rem .6rem; border-radius: 4px; }
.costo-art { margin: .4rem 0 .2rem; font-size: 1.05rem; }
.costo-storia { display: flex; flex-direction: column; gap: .2rem; margin: .3rem 0 .8rem; }
.costo-riga { display: grid; grid-template-columns: 8rem 7rem 5rem 1fr; gap: .5rem; align-items: baseline; padding: .3rem .5rem; border-bottom: 1px solid var(--col-border, #e5e9ef); }
.costo-riga small { color: var(--col-muted, #555); }
.costo-riga.costo-oggi { background: #f4f8fd; font-weight: 600; }
.costo-riga.costo-prima { background: #fff7e6; }
.costo-carichi { display: flex; flex-direction: column; gap: .3rem; }
.costo-car { border: 1px solid var(--col-border, #dde3ea); border-left: 4px solid #2a78d6; border-radius: 8px; padding: .4rem .6rem; background: #fff; }
.costo-car-testa { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.costo-car small { display: block; color: var(--col-muted, #555); margin-top: .15rem; }
.costo-car.costo-fuori { border-left-color: #c62828; background: #fff5f5; }
.costo-car.costo-riparte { border-left-color: #fd7e14; background: #fff8ef; }
.costo-car.costo-apertura { border-left-color: #6c757d; background: #f8f9fa; }
@media (max-width: 600px) { .costo-riga { grid-template-columns: 1fr auto; } .costo-riga small { grid-column: 1 / -1; } }
@media print { .aum-riga-bar { display: none; } }

/* 1.119.2: articoli del cliente (terzo livello di «Costi saliti»): l'articolo in grassetto, il cliente in piccolo */
.aum-cli { display: block; color: var(--col-muted, #6b7280); font-weight: 400; font-size: .82rem; margin-top: .1rem; }

/* ===== 1.127.0: assistenza ai clienti del portale ===== */
.tile-allarme { border-color: #dc3545; box-shadow: 0 0 0 2px rgba(220,53,69,.35); animation: ass-pulsa 1.4s ease-in-out infinite; }
@keyframes ass-pulsa { 50% { box-shadow: 0 0 0 6px rgba(220,53,69,.12); } }
.ass-sfondo { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; }
.ass-box { background: var(--col-surface, #fff); color: var(--col-text, #222); border-radius: 14px; max-width: 420px; width: 100%; padding: 20px 18px 16px; text-align: center;
  border-top: 6px solid #dc3545; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.ass-box h2 { margin: 6px 0 4px; font-size: 1.25rem; }
.ass-box p { margin: 4px 0; }
.ass-ico { font-size: 2.6rem; line-height: 1; animation: ass-scuoti 1s ease-in-out infinite; }
@keyframes ass-scuoti { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.ass-testo { font-style: italic; background: var(--col-bg, #f5f5f5); border-radius: 8px; padding: 6px 10px; margin: 8px 0; text-align: left; white-space: pre-wrap; }
.ass-az { display: flex; gap: 8px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.ass-az .btn-primary { font-size: 1.1rem; padding: 10px 22px; }
.ass-lista { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.ass-card { background: var(--col-surface); border: 1px solid var(--col-border); border-radius: 10px; padding: 10px 12px; }
.ass-card .actions { margin-top: 8px; }
.ass-card-attesa { border-color: #dc3545; border-left-width: 5px; }
.ass-card-mia { border-color: #28a745; border-left-width: 5px; }
.ass-chiuse .ass-card { opacity: .75; }
.ass-r1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ass-stato { font-size: .8rem; padding: 2px 8px; border-radius: 10px; background: var(--col-bg, #eee); white-space: nowrap; }
.ass-st-attesa { background: #dc3545; color: #fff; }
.ass-st-presa { background: #fd7e14; color: #fff; }
.ass-st-consenso { background: #6f42c1; color: #fff; }
.ass-st-attiva { background: #28a745; color: #fff; }
.ass-st-no { background: #6c757d; color: #fff; }
.ass-coll-si, .ass-coll-no { display: block; margin-top: 4px; }
.ass-coll-no { color: #b35c00; font-weight: 600; }
.ass-attendi, .ass-ok { margin: 6px 0 0; }
.ass-ok { color: #1e7e34; font-weight: 600; }
.prof-box { display: flex; gap: 14px; align-items: flex-start; margin: 8px 0 14px; flex-wrap: wrap; }
.prof-foto { width: 96px; height: 96px; border-radius: 50%; flex: 0 0 96px; background: #2c7be5 center / cover no-repeat; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 700; border: 3px solid var(--col-border); }
.prof-dx { flex: 1 1 220px; min-width: 0; }
.prof-dx label { display: block; }
.prof-dx input[type=text] { width: 100%; }
.prof-dx .actions { margin: 8px 0 4px; flex-wrap: wrap; }
.ut-sez { display: block; margin-top: 12px; }
.ass-h1 { font-size: clamp(1.3rem, 5vw, 1.8rem); }

/* ===== 1.128.0: voce dell'assistenza ===== */
.ass-voce { position: fixed; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 8500; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: center; max-width: calc(100% - 24px); background: #1e3a8a; color: #fff; border-radius: 14px; padding: 8px 10px 8px 14px; box-shadow: 0 8px 26px rgba(0,0,0,.35); }
.ass-voce-in_linea { background: #1e7e34; }
.ass-voce-interrotta { background: #b45309; }
.ass-voce-chiamo .ass-voce-txt strong { animation: ass-pulsa-testo 1.2s ease-in-out infinite; }
@keyframes ass-pulsa-testo { 50% { opacity: .55; } }
.ass-voce-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.ass-voce-txt strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.ass-voce-txt small { opacity: .9; }
.ass-voce-az { display: flex; gap: 6px; }
.ass-voce .btn { margin: 0; }
.ass-voce .ass-muto-si { background: #fde68a; color: #7c2d12; border-color: #fde68a; }

/* ===== 1.130.0: messaggi dei clienti del portale ===== */
.chat-lista { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 14px; }
.chat-card { position: relative; background: var(--col-surface); border: 1px solid var(--col-border); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.chat-card:hover { border-color: var(--col-primary); }
.chat-card-attesa { border-left: 5px solid #dc3545; }
.chat-card-nuovi { border-left: 5px solid #28a745; }
.chat-anteprima { margin: 6px 0 0; color: var(--col-text, #222); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 30px; }
.chat-badge { position: absolute; right: 10px; bottom: 10px; }
.chat-card .actions { margin-top: 8px; }
.chat-box-nuovo { border-top-color: #2c7be5; }
.chat-ico { animation: none; }
.chat-area { height: calc(100vh - 250px); height: calc(100dvh - 250px); min-height: 320px; margin-top: 8px; }
.chat-pagina #cc-azioni { margin: 4px 0; flex-wrap: wrap; }

/* ===== 1.131.0: archivio dei messaggi dei clienti ===== */
.ca-filtri { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.ca-filtri #ca-q { flex: 1 1 100%; }
.ca-filtri select { flex: 1 1 160px; }
.ca-data { display: flex; align-items: center; gap: 6px; }
.ca-barra { flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.ca-barra .actions { flex-wrap: wrap; margin: 0; }
.ca-pagine { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 6px 0; }
.ca-pagine:empty { display: none; }
.ca-riga { display: flex; gap: 10px; cursor: default; }
.ca-scegli { padding-top: 2px; }
.ca-scegli input { width: 20px; height: 20px; }
.ca-corpo { flex: 1; min-width: 0; }
.ca-protetta { border-left: 5px solid #6f42c1; }
@media print {
  .chat-area { height: auto !important; }
  .chatv { height: auto !important; }
  .chatv-lista { overflow: visible !important; }
  .chatv-scrivi, #cc-azioni, .ass-voce, .ca-filtri, .ca-barra .actions, .ca-pagine, .ca-riga .actions, .ca-scegli { display: none !important; }
  .chatv-f { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
}

/* ===== 1.132.0: bottone «💬 Clienti» (come «💬 Arteca» nel portale) ===== */
.chat-flottante { position: fixed; right: 14px; bottom: 14px; z-index: 800; border: 0; border-radius: 999px; padding: .7rem 1.05rem; font-size: 1rem; font-weight: 700;
  background: #1d4ed8; color: #fff; box-shadow: 0 6px 20px rgba(29,78,216,.45); cursor: pointer; }
.chat-flottante:hover { background: #1e40af; }
.chat-flottante[hidden] { display: none; }
#cs-q { width: 100%; margin: 8px 0; }
@media print { .chat-flottante { display: none !important; } }

/* 1.149.0: D&M (fatturato, costo, margine e ricarico per periodo) */
.dm-barra { margin-bottom: .2rem; }
.dm-periodi { display: flex; flex-direction: column; gap: .3rem; margin: .2rem 0 .4rem; padding: .45rem .55rem; background: #f8fafc; border: 1px solid var(--col-border); border-radius: var(--radius); }
.dm-riga { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; }
.dm-et { font-weight: 600; min-width: 4.2rem; font-size: .85rem; color: var(--col-text-muted); }
.dm-spunta { display: inline-flex; align-items: center; gap: .25rem; margin: 0; font-size: .88rem; font-weight: 400; cursor: pointer; }
.dm-spunta input { width: auto; margin: 0; }
.dm-mese { border: 1px solid var(--col-border); background: #fff; border-radius: 999px; padding: .15rem .55rem; font-size: .82rem; cursor: pointer; }
.dm-mese.attivo { background: var(--col-primary); border-color: var(--col-primary); color: #fff; font-weight: 600; }
.dm-data input[type=date] { width: auto; margin: 0; }
.dm-bottoni { display: flex; flex-wrap: wrap; gap: .4rem; margin: .1rem 0 .4rem; }
.dm-bottoni .btn.attivo { background: var(--col-primary); color: #fff; border-color: var(--col-primary); }
.dm-pannello { display: flex; flex-wrap: wrap; gap: .35rem .9rem; align-items: center; padding: .5rem .6rem; margin: 0 0 .5rem; border: 1px dashed var(--col-border); border-radius: var(--radius); }
.dm-pannello.stat-filtri { display: grid; }
.dm-pannello label input[type=text] { width: 5rem; display: inline-block; margin-left: .3rem; }
.dm-tab th.dm-g { text-align: center; color: var(--col-text); border-bottom: 2px solid var(--col-primary); }
.dm-tab th.dm-g1 { background: #f1f5f9; }
.dm-tab th.dm-gd { border-bottom-color: #8b5cf6; }
.dm-tab-box .dm-tab thead tr.dm-gruppi th { top: 0; }
.dm-tab-box .dm-tab thead tr:nth-child(2) th { top: 1.9rem; }
.dm-tab .dm-ord { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: inherit; white-space: nowrap; }
.dm-tab td.dm-primo { border-left: 2px solid #e2e8f0; }
.dm-tab .dm-nome { white-space: normal; min-width: 14rem; max-width: 22rem; }
.dm-tab .dm-nome small { color: var(--col-text-muted); }
/* colonna del nome ferma mentre si scorre in orizzontale */
.dm-tab .dm-nome, .dm-tab .dm-nome-th { position: sticky; left: 0; z-index: 1; background: var(--col-surface, #fff); box-shadow: inset -1px 0 0 var(--col-border); }
.dm-tab-box .dm-tab thead th.dm-nome-th { z-index: 3; background: #eef2f7; }
.dm-tab tfoot td.dm-nome { z-index: 2; background: #eef2f7; }
.dm-tab button.dm-apri { background: none; border: 0; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--col-primary); padding: 0 .15rem; }
.dm-tab button.dm-cifra { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.dm-tab button.dm-cifra:hover, .dm-tab button.dm-cifra:focus-visible { text-decoration: underline; color: var(--col-primary); }
.dm-tab tr.dm-figlio td { background: #fbfdff; font-size: .8rem; }
.dm-tab tr.dm-figlio td.dm-nome { padding-left: 1.9rem; background: #fbfdff; }
.dm-tab td.dm-neg, .dm-tab td.dm-neg button { color: #c62828; }
.dm-tab tfoot td { font-weight: 700; border-top: 2px solid var(--col-border); position: sticky; bottom: 0; background: #eef2f7; }
.dm-abc-A { color: #1e7a46; font-weight: 700; } .dm-abc-B { color: #a16207; font-weight: 700; } .dm-abc-C { color: #64748b; }
/* 1.151.2 (Gae): D&M e Fatt. su tutta la larghezza della finestra, la tabella prende lo spazio che c'è */
#app-main:has(.stat-corpo.dm-largo) { max-width: none; padding-left: .5rem; padding-right: .5rem; }
#app-main:has(.stat-corpo.dm-largo) > .page { padding-left: .75rem; padding-right: .75rem; }
/* 1.150.0: Fatt. x … e livelli */
.dm-livelli { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; margin: 0.3rem 0; }
.dm-livelli select { max-width: 12rem; }
.dm-tab tr.dm-liv2 td { background: #fbfcfe; }
.dm-tab tr.dm-liv3 td { background: #f7f9fc; }
.dm-riep { border: 1px solid var(--col-border); border-radius: 8px; padding: 0.5rem 0.7rem; margin: 0.5rem 0; background: var(--col-surface, #fff); }
.dm-riep-testa { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.4rem; }
.dm-riep-testa select { width: auto; flex: 0 0 auto; }
.dm-riep-corpo { display: flex; flex-direction: column; gap: 0.6rem; }
.dm-riep-corpo > .stat-tab-box { min-width: 0; }
.dm-riep-tab .dm-cifra { border: 0; background: none; padding: 0; font: inherit; color: var(--col-primary); cursor: pointer; text-decoration: underline dotted; }
.dm-riep-tab td.dm-riep-pc { color: var(--col-text-muted); font-size: 0.85em; }
.dm-graf-box { width: 100%; max-width: 46rem; position: relative; }
.dm-graf { width: 100%; height: auto; display: block; }
.dm-graf-griglia { stroke: #e5e7eb; stroke-width: 1; }
.dm-graf-asse { fill: var(--col-text-muted); font-size: 11px; }
.dm-graf-croce { stroke: #94a3b8; stroke-width: 1; stroke-dasharray: 3 3; }
.dm-graf-leg { display: flex; flex-wrap: wrap; gap: 0.8rem; font-size: 0.85rem; margin-bottom: 0.2rem; }
.dm-graf-pal { display: inline-block; width: 0.8rem; height: 0.25rem; border-radius: 2px; margin-right: 0.3rem; vertical-align: middle; }
.dm-graf-fum { position: absolute; top: 1.6rem; background: #fff; border: 1px solid var(--col-border); border-radius: 6px; padding: 0.3rem 0.5rem; font-size: 0.8rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.12); pointer-events: none; white-space: nowrap; }
/* 1.151.0: filtri a più valori della D&M e della Fatt.: chi è scelto si vede bene */
.dm-fil-attivo { background: #1d5fae !important; color: #fff !important; border-color: #1d5fae !important; font-weight: 600; }
.dm-voce-scelta { background: #e3eefc; font-weight: 600; }
.dm-chip-scelto { background: #1d5fae; color: #fff; }
.dm-scelte { display: flex; flex-wrap: wrap; gap: .35rem; margin: .1rem 0 .6rem; }
.dm-scelta { border: 0; border-radius: 999px; padding: .3rem .75rem; font-size: .9rem; font-weight: 600; cursor: pointer; color: #fff; background: #1d5fae; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.dm-scelta small { font-weight: 400; opacity: .85; margin-right: .2rem; }
.dm-scelta-ag { background: #7a4fb0; } .dm-scelta-zona { background: #0b7285; } .dm-scelta-cat { background: #b85a0b; }
.dm-scelta-prov { background: #5c6b7a; } .dm-scelta-catm { background: #2e7d32; } .dm-scelta-arti { background: #1e7b34; } .dm-scelta-cli { background: #1d5fae; }
.dm-scelta:hover { filter: brightness(1.1); text-decoration: line-through; }
@media print { .dm-scelte { display: none; } }
/* 1.152.0: 📄 il documento vero nelle righe dei documenti di D&M e Fatt. */
.dm-tab button.dm-pdf { background: none; border: 1px solid var(--col-border); border-radius: 6px; font-size: .95rem; line-height: 1; cursor: pointer; padding: .1rem .3rem; margin-left: .35rem; vertical-align: middle; }
.dm-tab button.dm-pdf:hover, .dm-tab button.dm-pdf:focus-visible { border-color: var(--col-primary); background: #eef6f1; }
@media print { .dm-tab button.dm-pdf { display: none; } }

/* 1.154.0: clienti potenziali (archivio a parte, offerte OP) */
.pot-bottoni { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }
.pot-bottoni .btn-nuovo-pot { margin-bottom: 0; }
.pot-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.5rem 0; }
.pot-filtri { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; }
.pot-filtri input[type=search] { flex: 1 1 14rem; min-width: 10rem; }
.pot-filtri select { flex: 0 1 auto; max-width: 16rem; }
.pot-date { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.pot-date input { width: auto; }
.pot-riga small { display: block; }
.pot-riga .st-badge { margin-left: 0.3rem; vertical-align: middle; }
.cli-pot-offerte { margin: 0.75rem 0; }
.cli-pot-offerte > .btn { margin-bottom: 0.5rem; }

/* 1.155.0: banca d'appoggio del potenziale (sportelli ABI/CAB) */
.pot-banche { display: flex; flex-direction: column; gap: 0.25rem; max-height: 16rem; overflow-y: auto; }
.pot-banca-riga { text-align: left; padding: 0.45rem 0.6rem; border: 1px solid var(--col-bordo, #d0d7de); border-radius: 8px; background: #fff; font-size: 0.9rem; cursor: pointer; }
.pot-banca-riga:hover { background: #eef4fb; }

/* 1.157.0: sessioni attive */
.ses-tipi { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ses-tipi .attivo { background: var(--col-primary); color: #fff; }
.ses-filtro { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.ses-filtro input { flex: 1 1 220px; min-width: 0; }
.ses-riga { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--col-border); }
.ses-riga:first-child { border-top: 0; }
.ses-chi { min-width: 0; flex: 1 1 260px; }
.ses-chi strong, .ses-chi small { display: block; overflow-wrap: anywhere; }
.ses-chi small { color: var(--col-text-muted); }
.ses-mia .ses-chi strong { color: var(--col-ok); }
.ses-az { display: flex; gap: 6px; flex-wrap: wrap; }
