/* Gestionale: sobrio e leggibile. Il colore compare solo quando significa qualcosa
   (rosso = scaduto o in perdita, verde = incassato o in attivo, ambra = vicino alla scadenza).
   L'unico colore "di servizio" è l'accento blu: voce attiva, selezione, focus, avanzamento, link nel testo.

   Indice: 1 token · 2 base · 3 testata, menu, barra a tab · 4 schede e cifre · 5 tabelle · 6 etichette, avvisi, stati vuoti
           · 7 moduli e pulsanti · 8 toast e dialoghi · 9 pagine (ore, cruscotto, banca, commessa) · 10 telefono
           · 11 documenti · 12 verifica, emissione · 13 schermi stretti */

/* ---------------------------------------------------------------- 1 token */
:root {
  --bg: #F6F6F3;
  --surface: #FFFFFF;
  --subtle: #F1F1EE;
  --text: #1C2230;
  --text-2: #5A6272;
  --border: #E4E4DF;
  --border-forte: #C9C9C2;
  --bordo-controllo: #838996;            /* campi, menu, chip: ≥3:1 sul fondo (WCAG 1.4.11) */
  --ink: #1C2230;
  --ink-text: #FFFFFF;
  --accento: #2447C6;                    /* interattivo e selezionato */
  --accento-bg: #E8EDFD;
  --accento-testo: #FFFFFF;
  --rosso: #B3261E;   --rosso-bg: #FBEDEB;
  --verde: #177245;   --verde-bg: #EAF5EE;
  --ambra: #9A5B00;   --ambra-bg: #FFF4E0;
  --blu: #2F4DA8;     --blu-bg: #EDF1FC;
  --evidenzia: #FFFBE6;
  /* scala: 12 · 14 · 16 · 18 · 24 · 28 */
  --t-xs: 12px; --t-sm: 14px; --t-md: 16px; --t-lg: 18px; --t-xl: 24px; --t-xxl: 28px;
  /* spazi */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --r: 12px; --r-sm: 8px;
  --ombra-1: 0 1px 2px rgba(20, 24, 36, .06);
  --ombra-2: 0 10px 30px -8px rgba(20, 24, 36, .28);
  --tempo: 150ms;
  --altezza-tab: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171C; --surface: #1D2027; --subtle: #252932; --text: #E8EAEE; --text-2: #A0A7B4; --border: #30343E; --border-forte: #4A505C;
    --bordo-controllo: #6C7381;
    --ink: #E8EAEE; --ink-text: #15171C;
    --accento: #8FA8FF; --accento-bg: #1F2A4D; --accento-testo: #15171C;
    --rosso: #FF8A80; --rosso-bg: #3A1E1D; --verde: #7FD6A4; --verde-bg: #173024; --ambra: #F5C06A; --ambra-bg: #3A2E14;
    --blu: #9DB2FF; --blu-bg: #1E2640; --evidenzia: #33301C;
    --ombra-1: 0 1px 2px rgba(0, 0, 0, .3);
    --ombra-2: 0 10px 30px -8px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- 2 base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--t-md)/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: inherit; text-underline-offset: 3px; }
h1 { font-size: var(--t-xxl); line-height: 1.2; margin: 0 0 var(--s2); letter-spacing: -0.015em; }
h2 { font-size: var(--t-lg); line-height: 1.3; margin: 0 0 var(--s3); }
h3 { font-size: var(--t-md); margin: var(--s4) 0 var(--s2); }
.h2-pagina { font-size: 20px; margin: 0; }
p { margin: 0 0 var(--s2); }
code { font-size: var(--t-sm); background: var(--subtle); padding: 1px 5px; border-radius: 4px; word-break: break-all; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accento); outline-offset: 2px; }
.solo-lettori { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.pagina { max-width: 1180px; margin: 0 auto; padding: var(--s5) var(--s4) 64px; }
.spiega { color: var(--text-2); max-width: 820px; font-size: var(--t-sm); }
.spiega ol { margin: var(--s2) 0; padding-left: 20px; }
.sottotitolo { color: var(--text-2); margin: 0 0 var(--s4); max-width: 820px; }
.tenue { color: var(--text-2); font-size: var(--t-sm); }
.briciole { font-size: var(--t-sm); color: var(--text-2); margin-bottom: var(--s1); }
.vuoto { color: var(--text-2); }
.a-capo { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.riduci { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 460px; }
.spiega a, .tenue a, .vuoto a, .briciole a, .lista-link a, .sottotitolo a { color: var(--accento); }

/* "Come funziona": istruzioni che si richiudono e restano chiuse (ricordato dal browser) */
details.come { margin: 0 0 var(--s4); }
details.come > summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--accento); font-size: var(--t-sm); font-weight: 600; list-style: none; min-height: 32px; }
details.come > summary::-webkit-details-marker { display: none; }
details.come > summary::before { content: "?"; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; }
details.come[open] > summary { margin-bottom: var(--s2); }

.titolo-riga { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin: var(--s2) 0 var(--s3); }
.titolo-riga h1, .titolo-riga h2 { margin-bottom: 0; }
.azioni-testa { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 3 testata, menu, barra a tab */
.testata { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.testata-in { max-width: 1180px; margin: 0 auto; padding: 0 var(--s4); display: flex; align-items: center; gap: var(--s3); min-height: 56px; }
.marchio { font-weight: 700; text-decoration: none; white-space: nowrap; max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
.menu { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; }
.menu a { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 7px 10px; border-radius: var(--r-sm); color: var(--text-2); white-space: nowrap; font-size: var(--t-sm); }
.menu a:hover { background: var(--subtle); color: var(--text); }
.menu a.attivo { background: var(--accento-bg); color: var(--accento); font-weight: 600; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--accento); color: var(--accento-testo); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.badge.allarme { background: var(--rosso); color: var(--surface); }
.testata-azioni { display: flex; align-items: center; gap: var(--s2); flex: 0 0 auto; }
.ricerca { position: relative; }
.ricerca input { width: 150px; min-height: 36px; padding: 5px 10px 5px 32px; font-size: var(--t-sm); border-radius: 99px; background: var(--subtle); border-color: transparent; transition: width var(--tempo); }
.ricerca input:focus { width: 240px; background: var(--surface); border-color: var(--bordo-controllo); outline-offset: 0; }
.ricerca svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.menu-nuovo { position: relative; }
.menu-nuovo > summary { list-style: none; cursor: pointer; }
.menu-nuovo > summary::-webkit-details-marker { display: none; }
.menu-nuovo .voci { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--ombra-2); padding: 6px; z-index: 30; }
.menu-nuovo .voci a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); text-decoration: none; font-size: var(--t-sm); }
.menu-nuovo .voci a:hover { background: var(--subtle); }
.menu-nuovo .voci svg { color: var(--text-2); flex: 0 0 auto; }
.icona-impostazioni { display: inline-flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: var(--t-sm); min-height: 36px; }
.icona-impostazioni:hover { background: var(--subtle); color: var(--text); }
.icona-impostazioni.attivo { background: var(--accento-bg); color: var(--accento); font-weight: 600; }

.tab-bar { display: none; }

/* ---------------------------------------------------------------- 4 schede e cifre */
.scheda { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s4) 18px; margin-bottom: var(--s4); box-shadow: var(--ombra-1); }
.scheda-testa { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s2); flex-wrap: wrap; }
.scheda-testa h2 { margin: 0; }
details.scheda > summary { cursor: pointer; list-style-position: outside; }
details.scheda[open] > summary { margin-bottom: 10px; }
.due { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); align-items: start; margin-bottom: var(--s4); }
.due > .scheda { margin-bottom: 0; }
.primi-passi { border-color: var(--accento); background: var(--accento-bg); }
.primi-passi ol { margin: 0; padding-left: 20px; }
.lista-link { margin: 0; padding-left: 18px; }
.lista-link li { margin: var(--s1) 0; }

.cifre { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s3); margin: var(--s3) 0 var(--s4); }
.cifra { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px var(--s4); text-decoration: none; box-shadow: var(--ombra-1); }
a.cifra:hover { border-color: var(--bordo-controllo); }
.cifra-nome { font-size: var(--t-sm); color: var(--text-2); }
.cifra-valore { font-size: var(--t-xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; line-height: 1.25; }
.cifra-valore.nodato { color: var(--text-2); font-weight: 600; }
.cifra-nota { font-size: var(--t-sm); color: var(--text-2); }
.cifra-doppia { display: grid; gap: var(--s1); }
.cifra-doppia .riga { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); text-decoration: none; }
.cifra-doppia .riga b { font-size: var(--t-lg); font-variant-numeric: tabular-nums; }
.barra-av { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin: 6px 0 2px; }
.barra-av span { display: block; height: 100%; background: var(--accento); border-radius: 99px; }

/* ---------------------------------------------------------------- 5 tabelle */
.tabella-scorre { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-sm); }
th { text-align: left; font-weight: 600; color: var(--text-2); font-size: var(--t-xs); padding: 6px var(--s2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: var(--s2); border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--tempo); }
table.cliccabile tbody tr:hover td { background: var(--subtle); }
tfoot td { border-top: 1px solid var(--border); border-bottom: none; font-weight: 600; }
td > a:not(.bottone):not(.link) { text-decoration: none; font-weight: 600; color: var(--accento); }
td > a:not(.bottone):not(.link):hover { text-decoration: underline; }
.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.pos { color: var(--verde); }
.neg { color: var(--rosso); }
tr.spento td { color: var(--text-2); }
tr.evidenzia td { background: var(--evidenzia); }
td select { max-width: 220px; padding: 4px 6px; font-size: var(--t-sm); min-height: 34px; }

/* ---------------------------------------------------------------- 6 etichette, avvisi, stati vuoti */
.etichetta { display: inline-block; font-size: var(--t-xs); font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--subtle); color: var(--text-2); white-space: nowrap; }
.s-in_corso { background: var(--blu-bg); color: var(--blu); }
.s-preventivo { background: var(--ambra-bg); color: var(--ambra); }
.s-finita { background: var(--verde-bg); color: var(--verde); }
.s-rosso { background: var(--rosso-bg); color: var(--rosso); }
.s-neutro { background: var(--subtle); color: var(--text-2); font-weight: 500; }

.avviso { padding: 10px 14px; border-radius: var(--r); margin-bottom: 14px; background: var(--ambra-bg); color: var(--ambra); }
.avviso.ok { background: var(--verde-bg); color: var(--verde); }
.avviso.ko { background: var(--rosso-bg); color: var(--rosso); }
.avviso.info { background: var(--accento-bg); color: var(--accento); }
.avviso a { color: inherit; font-weight: 600; }

/* Elenco vuoto: una frase e il passo successivo */
.stato-vuoto { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); padding: var(--s3) 0; }
.stato-vuoto p { margin: 0; color: var(--text-2); max-width: 560px; }
.stato-vuoto b { color: var(--text); }
.stato-vuoto.al-centro { align-items: center; text-align: center; padding: var(--s5) var(--s3); }

/* ---------------------------------------------------------------- 7 moduli e pulsanti */
input, select, textarea { background: var(--surface); border: 1px solid var(--bordo-controllo); border-radius: var(--r-sm); padding: 8px 12px; min-height: 40px; min-width: 0; font-size: var(--t-md); }
input[type=checkbox], input[type=radio] { min-height: 0; accent-color: var(--accento); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accento); outline-offset: -1px; border-color: var(--accento); }
input::placeholder, textarea::placeholder { color: var(--text-2); opacity: .8; }
input[type=file] { padding: 6px; font-size: var(--t-sm); }
.modulo .campi { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3) var(--s4); }
.modulo label { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); }
.modulo label > input, .modulo label > select, .modulo label > textarea { font-weight: 400; color: var(--text); }
.modulo label small { font-weight: 400; }
.modulo .largo { grid-column: 1 / -1; }
.azioni { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.in-riga { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
label.in-riga { flex-direction: row !important; font-size: var(--t-sm); }
form.in-riga { margin-top: 10px; }
.in-linea { display: inline; }
.filtri { display: flex; gap: var(--s2); flex-wrap: wrap; margin: 0 0 var(--s3); }
.filtri input[name=cerca] { flex: 1 1 220px; }
.carica { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: var(--s4); border: 1.5px dashed var(--border-forte); border-radius: var(--r); }
.risultato { margin: var(--s3) 0; }
.proposta { display: flex; gap: 6px; align-items: center; }
.proposta select { max-width: 260px; }

.bottone { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; background: var(--ink); color: var(--ink-text); border: 1px solid var(--ink); border-radius: var(--r-sm);
  padding: 7px 16px; font-size: var(--t-sm); font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: opacity var(--tempo), border-color var(--tempo), background var(--tempo); }
.bottone:hover { opacity: .88; }
.bottone:disabled { opacity: .5; cursor: not-allowed; }
.bottone.secondario { background: var(--surface); color: var(--text); border-color: var(--bordo-controllo); }
.bottone.secondario:hover { border-color: var(--text-2); opacity: 1; background: var(--subtle); }
.bottone.testo { background: transparent; color: var(--accento); border-color: transparent; }
.bottone.testo:hover { background: var(--accento-bg); opacity: 1; }
.bottone.pericolo { background: var(--rosso); border-color: var(--rosso); color: var(--surface); }
.bottone.piccolo { min-height: 32px; padding: 3px 12px; }
.bottone.grande { min-height: 46px; padding: 10px 22px; font-size: var(--t-md); }
.bottone.in-attesa { position: relative; color: transparent !important; pointer-events: none; }
.bottone.in-attesa::after { content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-text); border-top-color: transparent; animation: gira .8s linear infinite; }
.link { background: none; border: none; padding: 0; color: var(--text-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: var(--t-sm); }
.link:hover { color: var(--text); }
button.link, a.link { min-height: 28px; display: inline-flex; align-items: center; }

.schede-filtro { display: flex; gap: var(--s1); margin: var(--s1) 0 var(--s3); overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: none; }
.schede-filtro a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; text-decoration: none; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: var(--t-sm); }
.schede-filtro a:hover { color: var(--text); }
.schede-filtro a.attivo { color: var(--accento); border-bottom-color: var(--accento); font-weight: 600; }
.mesi { display: flex; gap: 14px; font-size: var(--t-sm); }

/* ---------------------------------------------------------------- 8 toast e dialoghi */
.toasts { position: fixed; left: 0; right: 0; bottom: var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s2); z-index: 60; pointer-events: none; padding: 0 var(--s4); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s3); max-width: 560px; width: fit-content; background: var(--ink); color: var(--ink-text); border-radius: var(--r); padding: 12px var(--s4); box-shadow: var(--ombra-2); font-size: var(--t-sm); animation: sale .2s ease-out; }
.toast.ko { background: var(--rosso); color: var(--surface); }
.toast button { background: none; border: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 4px 2px; min-height: 32px; }
.toast.esce { opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; }
@keyframes sale { from { opacity: 0; transform: translateY(8px); } }
dialog.conferma { border: 1px solid var(--border); border-radius: 16px; padding: var(--s5); width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--ombra-2); }
dialog.conferma::backdrop { background: rgba(10, 12, 18, .5); }
dialog.conferma p { font-size: var(--t-md); margin-bottom: var(--s4); }
dialog.conferma .azioni { justify-content: flex-end; margin-top: 0; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- 9 pagine */
/* ore */
.righe-ore { display: flex; flex-direction: column; gap: var(--s2); margin: 10px 0; }
.riga-ore { display: grid; grid-template-columns: 160px minmax(180px, 1.3fr) 80px 1fr auto; gap: var(--s2); align-items: center; }
.riga-ore .nome { font-weight: 600; }
.riga-ore .link { white-space: nowrap; }
.corto { width: 100px; }
table.giorni td:first-child { white-space: nowrap; }

/* cruscotto "Oggi" */
.da-fare { padding: 0; overflow: hidden; }
.da-fare-testa { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: var(--s4) 18px var(--s2); }
.da-fare-testa h2 { margin: 0; }
.fare-riga { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 18px; border-top: 1px solid var(--border); position: relative; }
.fare-riga::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--border-forte); }
.fare-riga.t-rosso::before { background: var(--rosso); }
.fare-riga.t-ambra::before { background: var(--ambra); }
.fare-riga.t-blu::before { background: var(--accento); }
.fare-testo { flex: 1 1 auto; min-width: 0; }
.fare-testo b { font-variant-numeric: tabular-nums; }
.fare-nota { display: block; color: var(--text-2); font-size: var(--t-sm); }
.tutto-a-posto { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 18px var(--s4); color: var(--verde); font-weight: 600; }
.cantieri { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: var(--s3); }
.cantiere { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); border: 1px solid var(--border); border-radius: var(--r); text-decoration: none; background: var(--surface); }
.cantiere:hover { border-color: var(--bordo-controllo); }
.cantiere-testa { display: flex; justify-content: space-between; gap: var(--s2); align-items: flex-start; }
.cantiere-codice { font-size: var(--t-xs); font-weight: 700; color: var(--text-2); letter-spacing: .04em; }
.cantiere-nome { font-weight: 700; line-height: 1.25; }
.cantiere-cifre { display: flex; justify-content: space-between; gap: var(--s3); font-size: var(--t-sm); }
.cantiere-cifre span { display: flex; flex-direction: column; }
.cantiere-cifre small { color: var(--text-2); font-size: var(--t-xs); }
.cantiere-cifre b { font-variant-numeric: tabular-nums; }

/* banca: da sistemare */
.banca-stato { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin: 0 0 var(--s3); }
.banca-stato .barra-av { flex: 1 1 160px; max-width: 280px; margin: 0; }
table.banca td { vertical-align: middle; }
table.banca td.mov { min-width: 200px; }
table.banca td.c-scelta select { width: 150px; max-width: 150px; }
.mov-nome { display: block; font-weight: 700; }
.mov-descr { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-2); font-size: var(--t-xs); max-width: 380px; }
.suggerimento { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.suggerimento form { margin: 0; }
.suggerimento .tenue { font-size: var(--t-xs); }
tr.uscente { opacity: 0; transform: translateX(16px); transition: opacity .3s, transform .3s; }

/* commessa */
.sotto-nav { position: sticky; top: 56px; z-index: 10; display: flex; gap: var(--s1); margin: 0 calc(var(--s4) * -1) var(--s4); padding: 0 var(--s4); background: var(--bg); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.sotto-nav a { padding: 10px 12px; text-decoration: none; color: var(--text-2); font-size: var(--t-sm); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sotto-nav a:hover { color: var(--text); }
.sotto-nav a.attivo { color: var(--accento); border-bottom-color: var(--accento); font-weight: 600; }
.sezione { scroll-margin-top: 112px; }
.nota-commessa .testo-nota { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; }
.nota-commessa.aperta .testo-nota { display: block; }
.nota-commessa .link { margin-top: var(--s1); color: var(--accento); }

/* ---------------------------------------------------------------- 10 telefono (squadra e titolare in cantiere)
   Tocchi grandi, una colonna, il pulsante principale sempre raggiungibile col pollice. */
body.telefono { font-size: var(--t-md); padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
body:not(.telefono) .testata { padding-top: env(safe-area-inset-top); }
.m-testata { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); max-width: 560px; margin: 0 auto; }
.m-marchio { font-weight: 700; color: var(--text-2); font-size: var(--t-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-indietro { text-decoration: none; font-weight: 600; font-size: 17px; padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center; }
.m-pagina { max-width: 560px; margin: 0 auto; padding: 4px var(--s4) calc(110px + env(safe-area-inset-bottom)); }
body.con-tab .m-pagina { padding-bottom: calc(var(--altezza-tab) + 110px + env(safe-area-inset-bottom)); }
.m-titolo { font-size: var(--t-xxl); margin: 4px 0 14px; }
.m-scheda { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: var(--s4); margin-bottom: var(--s3); text-decoration: none; box-shadow: var(--ombra-1); }
.m-scheda h2 { font-size: var(--t-md); }
.m-scheda table td { padding: 9px 4px; }
.m-azioni { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--s4); }
.m-azione { display: flex; flex-direction: column; gap: 2px; padding: 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); text-decoration: none; min-height: 72px; justify-content: center; box-shadow: var(--ombra-1); }
.m-azione.principale { background: var(--ink); color: var(--ink-text); border-color: var(--ink); }
.m-azione-titolo { font-size: 19px; font-weight: 700; }
.m-azione-nota { font-size: var(--t-sm); opacity: .75; }
.m-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: var(--s3); }
.m-griglia .m-scheda { margin: 0; }
.m-link { display: flex; flex-direction: column; gap: var(--s1); }
.m-link b { font-size: 20px; font-variant-numeric: tabular-nums; }
.m-aiuto summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.m-aiuto p { margin-top: var(--s2); color: var(--text-2); }
.m-ore td:first-child { white-space: nowrap; width: 1%; }
.m-elenco { display: flex; flex-direction: column; }
.m-elenco a, .m-elenco .m-voce { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 14px 4px; min-height: 52px; border-top: 1px solid var(--border); text-decoration: none; }
.m-elenco > :first-child { border-top: none; }
.m-elenco .m-voce-nome { font-weight: 600; }
.m-sezione { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: var(--s5) 4px var(--s2); }
.m-giorni { display: flex; gap: var(--s2); margin-bottom: var(--s3); flex-wrap: wrap; }
.m-persona { display: grid; gap: var(--s2); }
.m-persona + .m-persona { border-top: 1px solid var(--border); padding-top: var(--s3); margin-top: var(--s3); }
.m-persona-nome { font-weight: 700; font-size: var(--t-lg); display: flex; justify-content: space-between; align-items: baseline; gap: var(--s2); }

.m-modulo .m-etichetta { display: block; font-size: var(--t-sm); font-weight: 600; color: var(--text-2); margin: var(--s3) 0 6px; }
.m-modulo .m-etichetta:first-child { margin-top: 0; }
.m-grande { display: block; width: 100%; font-size: 17px; padding: 13px 14px; border-radius: var(--r); margin-bottom: var(--s2); min-height: 50px; }
select.m-grande { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.m-bottone { display: flex; width: 100%; font-size: var(--t-lg); padding: 15px; border-radius: 14px; margin-top: var(--s2); min-height: 52px; }
.m-bottone:disabled { opacity: 1; background: var(--subtle); color: var(--text-2); border-color: var(--border); box-shadow: none; }
.m-fisso { position: fixed; left: var(--s4); right: var(--s4); bottom: calc(14px + env(safe-area-inset-bottom)); width: auto; max-width: 528px; margin: 0 auto; box-shadow: var(--ombra-2); z-index: 4; }
body.con-tab .m-fisso { bottom: calc(var(--altezza-tab) + 14px + env(safe-area-inset-bottom)); }
.m-nomi { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }
.m-nome { display: flex; align-items: center; gap: var(--s3); padding: 14px; border: 1px solid var(--bordo-controllo); border-radius: var(--r); font-size: 17px; font-weight: 600; min-height: 52px; }
.m-nome:has(input:checked) { border-color: var(--accento); box-shadow: inset 0 0 0 1px var(--accento); background: var(--accento-bg); }
.m-nome input { width: 22px; height: 22px; accent-color: var(--accento); }

.m-chip { display: flex; gap: var(--s2); margin-bottom: var(--s2); flex-wrap: wrap; }
.chip { flex: 1 0 auto; min-width: 54px; min-height: 48px; border: 1px solid var(--bordo-controllo); background: var(--surface); border-radius: var(--r); font-size: var(--t-lg); font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0 var(--s3); text-decoration: none; color: var(--text); transition: background var(--tempo); }
.chip.scelto, .chip:has(input:checked) { background: var(--accento); color: var(--accento-testo); border-color: var(--accento); }
.m-chip-testo .chip { font-size: var(--t-md); font-weight: 600; flex: 0 0 auto; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }

.m-foto { display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 120px; border: 2px dashed var(--bordo-controllo); border-radius: 14px; font-size: var(--t-lg); font-weight: 600; cursor: pointer; text-align: center; padding: var(--s4); position: relative; }
.m-foto input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.m-foto svg { flex: 0 0 auto; }
.m-anteprime { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); margin-top: 10px; }
.m-anteprime:empty { display: none; }
.m-anteprime img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sm); }
.m-riga-ore { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--border); }
.m-riga-ore:first-of-type { border-top: none; }
.m-riga-ore .quando { width: 78px; color: var(--text-2); font-size: var(--t-sm); flex: 0 0 auto; }
.m-riga-ore .cosa { flex: 1 1 auto; min-width: 0; }
.m-riga-ore .ore { font-weight: 700; font-variant-numeric: tabular-nums; }
.m-riga-ore .togli { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); font-size: var(--t-sm); background: none; border: none; text-decoration: underline; cursor: pointer; }
.m-fatto { display: flex; align-items: center; gap: var(--s3); }
.m-fatto svg { color: var(--verde); flex: 0 0 auto; }

/* "Da fare ora" sul telefono: ogni voce è un tocco unico */
.m-da-fare { padding: var(--s4) var(--s4) var(--s1); }
.m-fare { display: flex; align-items: center; gap: var(--s3); padding: 12px 4px 12px var(--s3); margin: 0 calc(var(--s1) * -1); min-height: 56px; text-decoration: none; position: relative; border-top: 1px solid var(--border); }
.m-fare::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 4px; background: var(--border-forte); }
.m-fare.t-rosso::before { background: var(--rosso); }
.m-fare.t-ambra::before { background: var(--ambra); }
.m-fare.t-blu::before { background: var(--accento); }
.m-fare .fare-testo { padding-left: var(--s2); }
.m-freccia { color: var(--text-2); font-size: 22px; line-height: 1; }
.risultati { list-style: none; margin: 0; padding: 0; }
.risultati li { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.risultati li:first-child { border-top: none; }
.risultati a { text-decoration: none; color: var(--accento); }
.risultati a:hover { text-decoration: underline; }

/* barra a tab in basso: titolare da telefono (sulle pagine /m sempre, sulle altre sotto i 760px) */
body.telefono .tab-bar { display: grid; }
.tab-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border);
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.tab-bar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: var(--altezza-tab); text-decoration: none; color: var(--text-2); font-size: 11px; font-weight: 600; }
.tab-bar a svg { width: 24px; height: 24px; }
.tab-bar a.attivo { color: var(--accento); }
.tab-bar a.attivo::before { content: ""; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accento); }
.tab-bar .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

/* codici QR nelle impostazioni */
.qr-griglia { display: flex; gap: 20px; flex-wrap: wrap; margin: var(--s3) 0; }
.qr { width: 220px; }
.qr svg { width: 200px; height: 200px; background: #fff; border-radius: 10px; display: block; }
.qr p { margin-top: var(--s2); font-size: var(--t-sm); }

/* sunto dell'estratto conto */
.controlli { list-style: none; padding: 0; margin: var(--s1) 0 0; font-size: var(--t-sm); }
.controlli li { margin: 2px 0; }
.azioni-fisse { position: sticky; bottom: 0; z-index: 3; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--bg); padding: var(--s3) 0; margin-bottom: var(--s4); border-top: 1px solid var(--border); }
.schede-filtro.piccole { border: none; margin: 0; }
.schede-filtro.piccole a { padding: var(--s1) 10px; font-size: var(--t-sm); }
td .riduci { display: -webkit-box; }

/* ---------------------------------------------------------------- 11 sezione Documenti
   A sinistra le categorie come cartelle (tutte uguali: icona, nome, numero); al centro il grande riquadro "Trascina qui". */
.sezione-doc { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.cartelle { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; padding: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; max-height: calc(100vh - 96px); overflow-y: auto; }
.cartelle-titolo { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2);
  padding: 10px 10px 6px; }
.cartelle-titolo:not(:first-child) { margin-top: var(--s2); border-top: 1px solid var(--border); padding-top: 14px; }
.cartella { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 10px; border-radius: 9px;
  text-decoration: none; color: var(--text); font-size: var(--t-sm); line-height: 1.25; }
.cartella .icona { flex: 0 0 auto; color: var(--text-2); }
.cartella-nome { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartella .conta { flex: 0 0 auto; min-width: 26px; padding: 1px 7px; border-radius: 99px; text-align: center;
  font-size: var(--t-xs); font-weight: 600; font-variant-numeric: tabular-nums; background: var(--subtle); color: var(--text-2); }
.cartella:hover { background: var(--subtle); }
.cartella.vuota .cartella-nome { color: var(--text-2); }
.cartella.attiva { background: var(--accento-bg); color: var(--accento); font-weight: 600; }
.cartella.attiva .icona, .cartella.attiva .cartella-nome { color: var(--accento); }
.cartella.attiva .conta { background: var(--accento); color: var(--accento-testo); }
.cartella .conta.allarme { background: var(--rosso-bg); color: var(--rosso); }
.cartella:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }
.contenuto-doc { min-width: 0; }
.contenuto-doc > .titolo-riga:first-child { margin-top: 0; }

.trascina { margin: 0 0 20px; }
.trascina-zona { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: clamp(280px, 42vh, 440px); padding: 36px 28px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-forte); border-radius: 20px; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s; }
.trascina-zona:hover { border-color: var(--text-2); }
.trascina-zona:focus-visible { outline: 3px solid var(--accento); outline-offset: 3px; }
.trascina-zona.sopra { border-color: var(--accento); border-style: solid; background: var(--accento-bg); box-shadow: 0 0 0 6px var(--accento-bg); }
.trascina-cerchio { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: var(--subtle);
  color: var(--text); margin-bottom: 6px; }
.trascina-zona.sopra .trascina-cerchio { background: var(--surface); }
.trascina-titolo { font-size: var(--t-xl); line-height: 1.25; letter-spacing: -0.01em; max-width: 620px; }
.trascina-spiega { color: var(--text-2); max-width: 600px; font-size: var(--t-md); }
.trascina-oppure { margin-top: 6px; font-size: var(--t-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.trascina-attesa { cursor: progress; }
/* riquadro compatto quando ci sono già dei documenti: una riga sola, il resto si vede al trascinamento */
.trascina.compatto .trascina-zona { flex-direction: row; justify-content: flex-start; text-align: left; min-height: 0; padding: var(--s3) var(--s4); gap: var(--s3); border-radius: var(--r); }
.trascina.compatto .trascina-cerchio { width: 44px; height: 44px; margin: 0; flex: 0 0 auto; }
.trascina.compatto .trascina-cerchio svg { width: 22px; height: 22px; }
.trascina.compatto .trascina-titolo { font-size: var(--t-md); max-width: none; }
.trascina.compatto .trascina-spiega, .trascina.compatto .trascina-oppure { display: none; }
.trascina.compatto .trascina-testi { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.trascina.compatto .trascina-zona::after { content: "Scegli i file"; flex: 0 0 auto; font-size: var(--t-sm); font-weight: 600; padding: 6px 14px; border: 1px solid var(--bordo-controllo); border-radius: var(--r-sm); }
.trascina-testi { display: contents; }
.rilascia { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; background: color-mix(in srgb, var(--accento) 16%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.rilascia span { background: var(--surface); border: 2px dashed var(--accento); color: var(--accento); border-radius: 20px; padding: var(--s5) 40px; font-size: var(--t-xl); font-weight: 700; }
body.trascinando .rilascia { display: grid; }
.solo-touch { display: none; }
@media (pointer: coarse) { .solo-mouse { display: none; } .solo-touch { display: inline; } }
.rotella { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--border); border-top-color: var(--accento);
  animation: gira 0.9s linear infinite; margin-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .rotella, .bottone.in-attesa::after { animation: none; } .toast { animation: none; } }

.appena { border-color: var(--accento); }
.appena-riga { display: grid; grid-template-columns: minmax(200px, 1fr) 2fr; gap: var(--s2) var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.appena-riga:last-child { border-bottom: none; }
.appena-modulo { display: grid; grid-template-columns: 1fr 1.6fr 1fr auto; gap: var(--s2); align-items: center; }
.appena-modulo select, .appena-modulo input { width: 100%; }
.appena-azione { grid-column: 2; }
table.documenti td { vertical-align: top; }
table.documenti select { max-width: 170px; }
table.documenti td:first-child { min-width: 220px; }
details.modifica summary { display: inline; list-style: none; }
details.modifica summary::-webkit-details-marker { display: none; }
details.modifica[open] summary { display: none; }
details.modifica form { margin-top: 6px; }
details.modifica input[name=descrizione] { min-width: 260px; }

/* ---------------------------------------------------------------- 12 verifica dei preventivi, emissione fatture */
.verifica-testa { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.verifica-testa h2 { margin-bottom: 2px; }
.probabilita { flex: 0 0 150px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.probabilita-valore { font-size: 30px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.probabilita-nome { font-size: var(--t-sm); color: var(--text-2); }
.barra { width: 140px; height: 6px; border-radius: 99px; background: var(--subtle); overflow: hidden; margin-top: var(--s1); }
.barra span { display: block; height: 100%; background: var(--text-2); }
.v-probabile { border-left: 4px solid var(--verde); }
.v-probabile .probabilita-valore, .v-probabile .probabilita-nome { color: var(--verde); }
.v-probabile .barra span { background: var(--verde); }
.v-possibile { border-left: 4px solid var(--ambra); }
.v-possibile .probabilita-valore { color: var(--ambra); }
.v-possibile .barra span { background: var(--ambra); }
.v-improbabile { border-left: 4px solid var(--border-forte); }
.v-non-verificabile { border-left: 4px dashed var(--border-forte); }
.prove { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-sm); }
.prove .favore { color: var(--verde); }
.prove .contro { color: var(--rosso); }
.prove .neutra { color: var(--text-2); }
.verifica .azioni { margin-top: 10px; }

.righe-fattura textarea { width: 100%; min-width: 220px; resize: vertical; }
.righe-fattura td { vertical-align: top; }
.righe-fattura select { max-width: 230px; }
.righe-fattura .corto { width: 7.5em; }
.totali-fattura { margin-left: auto; max-width: 320px; display: grid; gap: var(--s1); }
.totali-fattura div { display: flex; justify-content: space-between; gap: var(--s4); }
.totali-fattura .grande { border-top: 1px solid var(--border-forte); padding-top: 6px; font-size: 1.15em; }
.scelta-tipo { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.scelta-tipo label { display: flex; flex-direction: row; gap: 6px; align-items: center; font-size: var(--t-md); color: var(--text); font-weight: 400; }
.barra-azioni { position: sticky; bottom: 0; background: var(--bg); padding: var(--s3) 0; border-top: 1px solid var(--border); z-index: 3; }
.invio-da_inviare { border-left: 4px solid var(--ambra); }
.invio-scartata { border-left: 4px solid var(--rosso); }
.invio-inviata { border-left: 4px solid var(--verde); }

/* ---------------------------------------------------------------- 13 schermi stretti
   Sotto i 760px: menu in alto sostituito dalla barra a tab, tabelle che diventano schede (nessuna colonna nascosta,
   nessuno scorrimento orizzontale), campi a 16px (iPhone non fa zoom), tocchi da 44px. */
@media (max-width: 900px) {
  .sezione-doc { grid-template-columns: 1fr; gap: 14px; }
  .cartelle { position: static; flex-direction: row; overflow-x: auto; max-height: none; padding: 6px; gap: 6px; scrollbar-width: none; }
  .cartelle-titolo { display: none; }
  .cartella { flex: 0 0 auto; border: 1px solid var(--border); border-radius: 99px; min-height: 40px; padding: 5px 12px; font-size: var(--t-sm); }
  .cartella .icona { width: 17px; height: 17px; }
  .trascina-zona { min-height: 220px; padding: 26px var(--s4); }
  .trascina-titolo { font-size: var(--t-lg); }
}
/* La testata è sempre compatta (ricerca a icona, «Impostazioni» a icona): con «Da approvare» il menu ha nove voci e non ci starebbero. Prima lo era solo sotto i 1240px. */
.icona-impostazioni .etichetta-lunga { display: none; }
.marchio { max-width: 130px; }
.ricerca { width: 36px; height: 36px; }
.ricerca input { width: 36px; padding-left: 10px; color: transparent; cursor: pointer; }
.ricerca input::placeholder { color: transparent; }
.ricerca input:focus { position: absolute; right: 0; top: 0; width: 260px; padding-left: 32px; color: var(--text); cursor: text; z-index: 5; }
.ricerca input:focus::placeholder { color: var(--text-2); }
@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .ricerca { width: 44px; height: 44px; }
  .risultati a { min-height: 44px; display: inline-flex; align-items: center; }
  .pagina { padding: var(--s4) var(--s4) calc(var(--altezza-tab) + 40px + env(safe-area-inset-bottom)); }
  .due, .modulo .campi { grid-template-columns: 1fr; }
  .testata-in { gap: 10px; min-height: 52px; }
  .menu { display: none; }
  .marchio { max-width: none; flex: 1 1 auto; font-size: var(--t-md); }
  .ricerca input { width: 44px; padding-left: 12px; color: transparent; background: transparent; }
  .ricerca input::placeholder { color: transparent; }
  .ricerca svg { left: 12px; }
  .ricerca input:focus { position: fixed; left: var(--s4); right: var(--s4); top: 8px; width: auto; color: var(--text); z-index: 50; padding-left: 36px; background: var(--surface); }
  .ricerca input:focus::placeholder { color: var(--text-2); }
  .menu-nuovo .voci { position: fixed; left: var(--s3); right: var(--s3); top: 56px; }
  .menu-nuovo .voci a { min-height: 48px; font-size: var(--t-md); }
  .tab-bar { display: grid; }
  .sotto-nav { top: 52px; }
  .cifra-valore { font-size: 22px; }
  .riga-ore { grid-template-columns: 1fr 80px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
  .riga-ore .nome { grid-column: 1 / -1; }
  .riga-ore select { grid-column: 1 / 2; }
  .riga-ore .note { grid-column: 1 / -1; }
  .riga-ore .link { grid-column: 1 / -1; justify-self: start; }
  .corto { width: 100%; }
  .appena-riga { grid-template-columns: 1fr; }
  .appena-modulo { grid-template-columns: 1fr; }
  .appena-azione { grid-column: 1; }
  .verifica-testa { flex-direction: column; }
  .probabilita { align-items: flex-start; }
  .toasts { bottom: calc(var(--altezza-tab) + var(--s3) + env(safe-area-inset-bottom)); }
  .azioni-fisse, .barra-azioni { bottom: calc(var(--altezza-tab) + env(safe-area-inset-bottom)); }

  /* tocchi e campi */
  input, select, textarea { font-size: 16px; min-height: 46px; }
  input[type=checkbox], input[type=radio] { min-height: 0; width: 22px; height: 22px; }
  td select { font-size: 16px; min-height: 46px; max-width: none; width: 100%; }
  .bottone { min-height: 46px; font-size: var(--t-md); }
  .bottone.piccolo { min-height: 44px; padding: 6px 14px; }
  button.link, a.link { min-height: 44px; min-width: 44px; justify-content: center; font-size: var(--t-md); }
  .marchio { display: inline-flex; align-items: center; min-height: 44px; }
  .ricerca input { min-height: 44px; }
  details.come > summary { min-height: 44px; }
  .menu-nuovo > summary.bottone { min-height: 44px; }
  .icona-impostazioni { min-width: 44px; min-height: 44px; justify-content: center; }
  .schede-filtro a { min-height: 44px; font-size: var(--t-md); }
  .schede-sezione a { min-height: 44px; display: inline-flex; align-items: center; font-size: var(--t-md); }
  .m-testata .bottone, .m-testata .link { min-height: 44px; }
  .mesi a { display: inline-flex; min-height: 44px; align-items: center; }
  .cartella { min-height: 44px; }
  .filtri input[name=cerca] { flex-basis: 100%; }
  .filtri select { flex: 1 1 140px; max-width: 100%; }

  /* tabelle → schede */
  .lista-schede { background: none; border: none; box-shadow: none; padding: 0; }
  .tabella-scorre:has(> table.a-schede) { overflow-x: visible; }
  table.a-schede, table.a-schede tbody, table.a-schede tfoot { display: block; width: 100%; }
  table.a-schede thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.a-schede tbody tr, table.a-schede tfoot tr { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--s3); padding: var(--s3) 14px; margin-bottom: var(--s2);
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); }
  table.a-schede tfoot tr { background: var(--subtle); }
  table.a-schede td { display: block; padding: 0; border: none; min-width: 0; grid-column: 1 / -1; }
  table.a-schede td.c-titolo { grid-column: 1; font-weight: 600; }
  table.a-schede td.c-lato { grid-column: 2; text-align: right; }
  table.a-schede td[data-label]:not(.c-titolo):not(.c-lato):not(.data):not(.c-scelta):not(:empty)::before { content: attr(data-label) ": "; color: var(--text-2); font-size: var(--t-sm); }
  table.a-schede td.n { text-align: left; white-space: normal; }
  table.a-schede td.c-lato.n { text-align: right; white-space: nowrap; }
  table.a-schede td.c-azioni { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
  table.a-schede td:empty { display: none; }
  table.a-schede td[colspan] { grid-column: 1 / -1; }
  table.a-schede tr.evidenzia { box-shadow: inset 4px 0 0 var(--ambra); }
  table.a-schede .riduci { max-width: none; }

  /* banca: scheda per movimento */
  table.banca tbody tr { grid-template-columns: 1fr auto; row-gap: var(--s2); }
  table.banca td.data { grid-column: 1 / -1; grid-row: 1; font-size: var(--t-xs); color: var(--text-2); }
  table.banca td.data::before, table.banca td.c-scelta::before { display: none; }
  table.banca td.mov { grid-column: 1; grid-row: 2; }
  table.banca td.importo { grid-column: 2; grid-row: 2; text-align: right; font-size: var(--t-md); font-weight: 700; white-space: nowrap; }
  table.banca td.sugg { grid-column: 1 / -1; grid-row: 3; }
  table.banca td.sugg:has(.suggerimento:empty) { display: none; }
  table.banca td.sugg .suggerimento { align-items: stretch; }
  table.banca td.sugg .proposta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
  table.banca td.sugg .proposta .bottone { flex: 1 1 auto; }
  table.banca td.sugg .proposta select { flex: 1 1 100%; max-width: none; }
  table.banca td.c-scelta select { width: 100%; max-width: none; }
  table.banca tr.ha-sugg:not(.aperto) td.c-scelta { display: none; }
  .mov-descr { max-width: none; }
}
@media (min-width: 761px) {
  .solo-mobile { display: none !important; }
}
@media (max-width: 760px) {
  .solo-desktop { display: none !important; }
}

/* ---------------------------------------------------------------- 14 assistente («Da approvare»): le righe, le tre colonne, il testo del messaggio, il diario */
.sg-colonne { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); align-items: start; margin-bottom: var(--s2); }
.sg-colonna { margin-bottom: 0; padding-bottom: var(--s3); }
.sg-colonna .scheda-testa h2 { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-md); }
.sg-riga { display: flex; align-items: center; gap: var(--s3); padding: 10px 0 10px 12px; border-top: 1px solid var(--border); position: relative; text-decoration: none; color: inherit; }
.sg-riga:hover { background: var(--subtle); }
.sg-riga::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--border-forte); }
.sg-riga.t-rosso::before { background: var(--rosso); }
.sg-riga.t-ambra::before { background: var(--ambra); }
.sg-riga.t-blu::before { background: var(--accento); }
.sg-testo { flex: 1 1 auto; min-width: 0; }
.sg-pallino { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--border-forte); vertical-align: middle; }
.sg-pallino.t-rosso { background: var(--rosso); } .sg-pallino.t-ambra { background: var(--ambra); } .sg-pallino.t-blu { background: var(--accento); }
.sg-legenda { margin: var(--s1) 0 var(--s4); }
.sg-verde { color: var(--verde); }
.sg-valore { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; font-size: var(--t-lg); }
.sg-preparato { display: flex; align-items: flex-start; gap: var(--s2); font-weight: 600; }
.sg-approva { align-items: center; }
.sg-testo-inviato { white-space: pre-wrap; background: var(--subtle); padding: var(--s3); border-radius: var(--r-sm); font: inherit; font-size: var(--t-sm); }
.sg-aff-probabile { background: var(--verde-bg); color: var(--verde); }
.sg-aff-verificato { background: var(--verde-bg); color: var(--verde); }
.sg-aff-indicativo { background: var(--ambra-bg); color: var(--ambra); }
.sg-aff-non_determinabile, .sg-aff-non-determinabile { background: var(--subtle); color: var(--text-2); }
.sg-prima-dopo { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.sg-prima-dopo > div { flex: 1 1 200px; }
.sg-albero, .sg-albero ul { list-style: none; margin: var(--s1) 0 var(--s1) var(--s4); padding: 0; }
.sg-albero { margin-left: 0; }
.sg-nodo { display: inline-block; margin: 3px 0; }
.sg-grafico { margin-top: var(--s3); }
.sg-barre { display: flex; align-items: flex-end; gap: 4px; height: 120px; margin: var(--s2) 0; }
.sg-barre > div { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; }
.sg-barra { width: 100%; background: var(--border-forte); border-radius: 3px 3px 0 0; min-height: 4px; }
.sg-barra.evidenziata { background: var(--accento); }
.sg-etichetta-barra { font-size: 10px; color: var(--text-2); margin-top: 2px; }
.sg-diario { list-style: none; margin: 0; padding: 0; }
.sg-diario-voce { display: flex; align-items: baseline; gap: var(--s3); padding: 8px 0; border-top: 1px solid var(--border); }
.sg-diario-voce:first-child { border-top: 0; }
.sg-diario-testo { flex: 1 1 auto; }
.sg-ignora { display: grid; gap: var(--s2); max-width: 520px; margin: var(--s2) 0; }
.sg-scelta { display: flex; align-items: center; gap: var(--s2); }
@media (max-width: 900px) { .sg-colonne { grid-template-columns: 1fr; } }

/* moduli con più gruppi di campi (es. accordi di una commessa): i titoli dei gruppi si staccano da quello che li precede */
.modulo-gruppi h2 { margin: var(--s5) 0 var(--s3); }
.modulo-gruppi h2:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- 15 chat con l'assistente */
.chat-pagina { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.chat { display: flex; flex-direction: column; gap: var(--s3); }
.chat-storia { display: flex; flex-direction: column; gap: var(--s2); min-height: 280px; max-height: 60vh; overflow-y: auto; padding: var(--s1); }
.bolla { max-width: 85%; padding: 10px 14px; border-radius: var(--r); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.bolla.mia { align-self: flex-end; background: var(--accento); color: var(--accento-testo); border-bottom-right-radius: 4px; }
.bolla.loro { align-self: flex-start; background: var(--subtle); border-bottom-left-radius: 4px; }
.bolla.attesa { color: var(--text-2); font-style: italic; }
.bolla.errore { background: var(--rosso-bg); color: var(--rosso); }
.chat-modulo { display: flex; gap: var(--s2); align-items: flex-end; }
.chat-modulo textarea { flex: 1; resize: vertical; min-height: 48px; }
.chat-aiuto h3 { margin: var(--s4) 0 var(--s2); font-size: var(--t-sm); color: var(--text-2); }
.chat-aiuto .esempio { text-align: left; }
@media (max-width: 860px) { .chat-pagina { grid-template-columns: 1fr; } .bolla { max-width: 92%; } }

/* ---------------------------------------------------------------- 16 listino */
.riga-riepilogo { margin: 0 0 var(--s3); }
.listino-capitolo h2 { margin-bottom: var(--s2); }
.voci-lista { display: flex; flex-direction: column; }
details.voce { border-top: 1px solid var(--border); }
details.voce:first-child { border-top: none; }
details.voce > summary { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 150px 180px; grid-template-areas: "cod tit seg int prezzo"; gap: var(--s2) var(--s3);
  align-items: center; padding: 10px 6px; cursor: pointer; list-style: none; border-radius: var(--r-sm); }
details.voce > summary::-webkit-details-marker { display: none; }
details.voce > summary:hover, details.voce[open] > summary { background: var(--subtle); }
.v-cod { grid-area: cod; color: var(--text-2); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
.v-tit { grid-area: tit; font-weight: 600; min-width: 0; }
.v-seg { grid-area: seg; }
.v-int { grid-area: int; text-align: right; white-space: nowrap; }
.v-prezzo { grid-area: prezzo; font-weight: 600; }
.voce-corpo { padding: var(--s3) 6px var(--s4); }
.voce-corpo h3 { font-size: var(--t-sm); color: var(--text-2); margin: var(--s4) 0 var(--s2); }
.voce-testo { max-width: 860px; margin: 0 0 var(--s2); }
.righe-voce td { vertical-align: top; }
.righe-voce tr.esclusa td { color: var(--text-2); }
.righe-voce tr.esclusa td.n { text-decoration: line-through; }
.voce-corpo .modulo { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border); }
.clausole { list-style: none; margin: 0; padding: 0; max-width: 860px; }
.clausole li { padding: 10px 0; border-top: 1px solid var(--border); }
.clausole li:first-child { border-top: none; }
@media (max-width: 760px) {
  details.voce > summary { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "tit prezzo" "seg int"; }
  .v-cod { display: none; }
  .v-int { text-align: right; }
}

/* ---------------------------------------------------------------- 17 preventivi */
.modulo .campi.tre { grid-template-columns: 2fr 3fr 1fr; }
.avviso-domande { background: var(--ambra-bg); color: var(--text); border-radius: var(--r-sm); padding: var(--s3); margin: var(--s2) 0; }
.avviso-domande ul { margin: var(--s1) 0 0; padding-left: 20px; }
.righe-prev td { vertical-align: top; }
.righe-prev tr.da-vedere > td { background: var(--evidenzia); }
.righe-prev input.q { width: 96px; text-align: right; min-height: 36px; padding: 4px 8px; }
.righe-prev input.nota { width: 100%; margin-top: 6px; min-height: 34px; padding: 3px 8px; font-size: var(--t-sm); }
.righe-prev textarea { width: 100%; margin-top: 6px; }
details.testo-voce > summary { cursor: pointer; display: inline; list-style: none; }
details.testo-voce > summary::-webkit-details-marker { display: none; }
details.testo-voce { display: inline; }
.togli { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-sm); color: var(--text-2); }
.totali-prev { max-width: 420px; margin-left: auto; }
.riga-tot { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 5px 0; }
.riga-tot.grande { border-top: 1.5px solid var(--text); margin-top: var(--s2); padding-top: var(--s2); font-size: var(--t-lg); }
.clausole-scelta { display: flex; flex-direction: column; gap: var(--s2); }
.spunta-riga { display: flex; gap: var(--s2); align-items: flex-start; font-weight: 400 !important; color: var(--text) !important; flex-direction: row !important; }
.spunta-riga input { margin-top: 4px; }
.riga-aggiungi { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; padding: var(--s3) 0; border-top: 1px solid var(--border); }
.riga-aggiungi:first-of-type { border-top: none; }
.riga-aggiungi label { flex: 1 1 140px; }
.riga-aggiungi label.largo { flex: 3 1 280px; grid-column: auto; }
@media (max-width: 760px) { .modulo .campi.tre { grid-template-columns: 1fr; } .totali-prev { max-width: none; } }
.suggerimenti { list-style: none; margin: 0; padding: 0; }
.suggerimenti li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.suggerimenti li:first-child { border-top: none; }
.num-riga { display: inline-block; min-width: 22px; color: var(--accento); }
.righe-prev tr.intestazione td { background: var(--subtle); padding: 8px; }
.righe-prev tr.misura td { padding-top: 2px; padding-bottom: 2px; padding-left: 32px; font-size: var(--t-sm); }
.righe-prev tr.totale-riga td { background: var(--subtle); border-top: 1.5px solid var(--border); text-align: right; }
.voce-scelta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--t-sm); color: var(--text-2); font-weight: 400; }
.voce-scelta input { width: 150px; min-height: 34px; padding: 3px 8px; font-size: var(--t-sm); }
.flag-riga { color: var(--ambra); font-size: var(--t-sm); margin-top: 4px; }
h2.sezione-secondaria { font-size: var(--t-md); color: var(--text-2); margin: var(--s4) 0 var(--s2); }

/* Le due viste delle Scadenze (elenco / chi ha cosa) */
/* Le parti di una sezione (Commesse · Preventivi · Listino, Ore · Persone): una riga sola in cima, uguale in tutte le pagine; sobria, perché la voce attiva del menu è già colorata */
.schede-sezione { display: flex; width: fit-content; max-width: 100%; gap: 2px; padding: 3px; margin: 0 0 var(--s4); background: var(--subtle); border-radius: var(--r); overflow-x: auto; scrollbar-width: none; }
.schede-sezione a { padding: 6px 16px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: var(--t-sm); font-weight: 500; white-space: nowrap; }
.schede-sezione a:hover { color: var(--text); }
.schede-sezione a.attiva { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--ombra-1); }
.schede-vista { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.schede-vista a { padding: 5px 14px; border-radius: 99px; background: var(--subtle); color: var(--text-2); text-decoration: none; font-weight: 500; }
.schede-vista a.attiva { background: var(--accento); color: var(--accento-testo); font-weight: 600; }

/* ---------------------------------------------------------------- 14 agenda: calendario del mese, voci, notifiche */
.ag-colonne { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: var(--s4); align-items: start; }
@media (max-width: 860px) { .ag-colonne { grid-template-columns: 1fr; } }
.cal-testa { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s2); }
.cal-testa h2 { margin: 0; font-size: var(--t-md); }
.cal-freccia { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; text-decoration: none; font-size: 24px; color: var(--text-2); }
.cal-freccia:hover { background: var(--subtle); color: var(--text); }
.cal-griglia { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal-griglia th { font-size: var(--t-xs); color: var(--text-2); font-weight: 600; padding: 4px 0; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.cal-griglia td { padding: 2px; text-align: center; }
.cal-griglia td > a.cal-giorno:not(.bottone):not(.link) { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 46px; border-radius: 10px; text-decoration: none; color: var(--text); }
.cal-griglia td > a.cal-giorno:not(.bottone):not(.link):hover { background: var(--subtle); }
.cal-griglia td.fuori > a.cal-giorno:not(.bottone):not(.link) { color: var(--text-2); opacity: .55; }
.cal-griglia td.oggi .cal-num { color: var(--accento); font-weight: 800; }
.cal-griglia td.scelto > a.cal-giorno:not(.bottone):not(.link) { background: var(--accento); color: var(--accento-testo); opacity: 1; }
.cal-griglia td.scelto .cal-num { color: inherit; }
.cal-num { font-variant-numeric: tabular-nums; line-height: 1.2; }
.cal-punti { display: flex; gap: 3px; height: 6px; margin-top: 2px; }
.cal-punti i, .cal-legenda i { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.p-voce { background: var(--accento); }
.p-scadenza { background: var(--ambra); }
.p-fatta { background: var(--verde); }
.cal-griglia td.scelto .p-voce { background: var(--accento-testo); }
.cal-legenda { margin: var(--s2) 0 0; display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }

.ag-elenco { list-style: none; margin: 0; padding: 0; }
.ag-voce { display: flex; gap: var(--s3); align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.ag-elenco > .ag-voce:first-child { border-top: none; }
.ag-spunta { margin: 0; flex: none; }
.ag-check { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bordo-controllo); background: var(--surface); color: var(--verde); font-weight: 800; cursor: pointer; padding: 0; line-height: 1; }
.ag-check:hover { border-color: var(--verde); }
.ag-voce.fatta .ag-check { background: var(--verde-bg); border-color: var(--verde); }
.ag-voce.fatta .ag-titolo b { text-decoration: line-through; color: var(--text-2); }
.ag-corpo { flex: 1; min-width: 0; }
.ag-titolo { overflow-wrap: anywhere; }
.ag-ora { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: var(--t-sm); margin-right: 6px; white-space: nowrap; }
.ag-azioni { display: flex; gap: var(--s3); flex: none; align-items: center; }
.ag-giorno { font-size: var(--t-sm); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: var(--s4) 0 var(--s1); }
.ag-giorno a { text-decoration: none; }
.ag-scadenza { margin: 0 0 var(--s2); }
.ag-arretrate { border-color: var(--ambra); background: var(--ambra-bg); }
.ag-modulo .azioni { display: flex; gap: var(--s3); align-items: center; margin-top: var(--s3); }
.ag-altro { margin-top: var(--s3); }
.ag-altro summary { cursor: pointer; color: var(--text-2); font-size: var(--t-sm); margin-bottom: var(--s2); }
.ag-stato { margin: 0 0 var(--s3); }
.ag-stato.ok { color: var(--verde); font-weight: 600; }
.ag-stato.ko { color: var(--rosso); font-weight: 600; }
.ag-campo { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-sm); font-weight: 600; color: var(--text-2); margin-bottom: var(--s3); }
.notifiche .azioni { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.notifiche .spiega ol { margin: var(--s2) 0; }
.ag-telefoni { list-style: none; margin: 0; padding: 0; }
.ag-telefoni li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 8px 0; border-top: 1px solid var(--border); }
.ag-nota { margin: var(--s3) 0 0; }
.ag-ore-campi { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; margin-top: var(--s3); }
.ag-ore-campi .ag-campo { margin-bottom: 0; }
.ag-telegram { margin: var(--s4) 0 0; padding-top: var(--s3); border-top: 1px solid var(--border); }
.ag-interruttore { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-sm); cursor: pointer; }
.ag-interruttore input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accento); }
body.telefono .ag-check { width: 34px; height: 34px; }
body.telefono .scheda { border-radius: 14px; }
@media (max-width: 520px) {
  .ag-voce { flex-wrap: wrap; }
  .ag-azioni { width: 100%; padding-left: 46px; }
}

/* Il profilo del dipendente: dati in due colonne (voce, valore) e il modulo per caricare un documento */
.profilo-dati { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0; }
.profilo-dati dt { color: var(--text-2); font-size: var(--t-sm); }
.profilo-dati dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.elenco-semplice { list-style: none; margin: var(--s3) 0; padding: 0; display: grid; gap: var(--s2); }
.carica-documento { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s3); }
@media (max-width: 760px) { .profilo-dati { grid-template-columns: 1fr; gap: 0; } .profilo-dati dd { margin-bottom: var(--s3); } }
