/* Aspetto ispirato agli ambienti di condivisione dati tipo ACC: barra scura, menu strumenti a sinistra,
   superfici chiare, angoli quasi vivi, un solo blu di accento. Marchio e nomi restano MP CDE. */
:root {
  --blu: #0696d7; --blu-scuro: #0577ad; --blu-chiaro: #e6f4fb; --blu-hover: #f0f8fc;
  --testo: #3c3c3c; --grigio: #666; --grigio-chiaro: #999; --bordo: #d9d9d9; --bordo-chiaro: #ebebeb;
  --sfondo: #f5f5f5; --bianco: #fff; --barra: #262626; --barra-hover: #3a3a3a;
  --rosso: #dd2222; --arancio: #e8890c; --azzurro: #2d74da; --verde: #5e9e1e; --giallo: #ffc21a;
  --raggio: 2px; --ombra: 0 2px 8px rgba(0, 0, 0, .16);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Artifakt Element", "Segoe UI", system-ui, sans-serif; color: var(--testo); background: var(--sfondo); display: flex; flex-direction: column; }
a { color: var(--blu); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; font-weight: 600; color: #262626; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 600; color: #262626; }
h3 { font-size: 12px; margin: 18px 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--grigio); }
.mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
.piccolo { font-size: 12px; color: var(--grigio); }
.vuoto, .caricamento { color: var(--grigio); padding: 20px 0; }
.errore { color: var(--rosso); }
.icona { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icona.piccola { width: 16px; height: 16px; }

/* barra superiore */
.barra { height: 48px; flex: none; background: var(--barra); color: #f2f2f2; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 0; box-shadow: 0 1px 0 #000; z-index: 20; }
.marchio { display: flex; align-items: center; gap: 10px; height: 100%; padding: 0 14px; color: #fff; text-decoration: none; border-right: 1px solid #3d3d3d; }
.marchio:hover { background: var(--barra-hover); text-decoration: none; }
.logo { width: 28px; height: 28px; border-radius: var(--raggio); background: var(--blu); color: #fff; font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; letter-spacing: .3px; }
.marchio-testo { font-weight: 600; font-size: 15px; line-height: 1.1; }
.marchio-testo small { display: block; font-weight: 400; font-size: 10px; color: #a6a6a6; letter-spacing: .2px; }
.sel-progetto-btn { height: 48px; border: 0; border-radius: 0; background: none; color: #fff; padding: 0 14px; display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: center; text-align: left; max-width: 420px; }
.sel-progetto-btn:hover { background: var(--barra-hover); }
.sel-etichetta { grid-column: 1 / 3; font-size: 10px; color: #a6a6a6; text-transform: uppercase; letter-spacing: .5px; line-height: 1.2; }
.sel-nome { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.briciole { display: flex; gap: 8px; align-items: center; min-width: 0; overflow: hidden; white-space: nowrap; padding-left: 6px; }
.briciole a, .briciole span { color: #cfcfcf; text-decoration: none; overflow: hidden; text-overflow: ellipsis; }
.briciole a:hover { color: #fff; text-decoration: underline; }
.briciole .sep { color: #777; }
.barra-dx { margin-left: auto; display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.barra-dx .posta { display: inline-flex; gap: 6px; align-items: center; background: #4a3b10; color: #ffd75e; border: 1px solid #806418; padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; text-decoration: none; }
.barra-dx .posta:hover { background: #5c4a14; }
.avatar { width: 32px; height: 32px; border-radius: 50%; border: 0; padding: 0; background: var(--blu); color: #fff; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.avatar:hover { box-shadow: 0 0 0 2px #fff; background: var(--blu); }
.avatar.grande { width: 44px; height: 44px; font-size: 15px; }

/* menu a tendina della barra */
.tendina { position: fixed; z-index: 70; background: #fff; border-radius: var(--raggio); box-shadow: 0 4px 18px rgba(0, 0, 0, .25); min-width: 280px; max-width: 420px; max-height: 70vh; overflow: auto; padding: 6px 0; color: var(--testo); }
.tendina input { margin: 4px 10px 6px; width: calc(100% - 20px); }
.tendina-voce { display: flex; gap: 6px; align-items: center; width: 100%; padding: 8px 16px; color: var(--testo); text-decoration: none; border: 0; border-radius: 0; background: none; text-align: left; }
.tendina-voce:hover { background: var(--blu-hover); text-decoration: none; }
.tendina-voce.sel { background: var(--blu-chiaro); box-shadow: inset 3px 0 0 var(--blu); }
.tendina-voce .tag { margin-left: auto; }
.tendina-voce.tutti { border-top: 1px solid var(--bordo-chiaro); margin-top: 4px; color: var(--blu); }
.tendina-utente { display: flex; gap: 12px; align-items: center; padding: 10px 16px 12px; border-bottom: 1px solid var(--bordo-chiaro); margin-bottom: 4px; }

#app { flex: 1; overflow: auto; padding: 24px 28px; }
#app.pieno { padding: 0; overflow: hidden; display: flex; }
.contenitore { max-width: 1280px; margin: 0 auto; }

/* progetto: menu degli strumenti + pagina */
.progetto { display: flex; flex: 1; min-width: 0; height: 100%; }
.nav-strumenti { width: 220px; flex: none; background: #fff; border-right: 1px solid var(--bordo); display: flex; flex-direction: column; padding: 8px 0; transition: width .15s; overflow: hidden; }
.nav-strumenti .spazio { flex: 1; }
.nav-voce { display: flex; align-items: center; gap: 14px; padding: 10px 18px; color: var(--testo); text-decoration: none; border: 0; border-radius: 0; background: none; width: 100%; white-space: nowrap; font-size: 14px; }
.nav-voce:hover { background: var(--sfondo); text-decoration: none; }
.nav-voce.sel { background: var(--blu-chiaro); color: var(--blu-scuro); font-weight: 600; box-shadow: inset 3px 0 0 var(--blu); }
.nav-comprimi { color: var(--grigio); border-top: 1px solid var(--bordo-chiaro); }
.nav-strumenti.compressa { width: 56px; }
.nav-strumenti.compressa .nav-voce span { display: none; }
.nav-strumenti.compressa .nav-comprimi .icona { transform: rotate(180deg); }
.progetto-corpo { flex: 1; min-width: 0; overflow: auto; padding: 22px 28px; }

/* controlli */
button, .btn { font: inherit; cursor: pointer; border: 1px solid #bfbfbf; background: var(--bianco); color: var(--testo); min-height: 32px; padding: 4px 14px; border-radius: var(--raggio); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: #808080; background: #fafafa; text-decoration: none; }
button:disabled { opacity: .45; cursor: default; }
.primario { background: var(--blu); border-color: var(--blu); color: #fff; font-weight: 600; }
.primario:hover { background: var(--blu-scuro); border-color: var(--blu-scuro); }
.pericolo { color: var(--rosso); }
.rosso-pieno { background: var(--rosso); border-color: var(--rosso); }
.rosso-pieno:hover { background: #b51b1b; border-color: #b51b1b; }
.menu-riga { min-height: 26px; padding: 0 8px; border-color: transparent; background: none; font-size: 16px; line-height: 1; color: var(--grigio); }
.menu-riga:hover { background: var(--sfondo); border-color: var(--bordo); }
.tabella td.col-menu { width: 40px; text-align: right; padding: 4px 8px; }
.verde { background: var(--verde); border-color: var(--verde); color: #fff; font-weight: 600; }
.verde:hover { background: #4d8417; border-color: #4d8417; }
.attivo { background: #fff4d6; border-color: var(--giallo); color: #5c4300; }
button.link { border: 0; background: none; padding: 0; min-height: 0; color: var(--blu); }
button.link:hover { text-decoration: underline; background: none; }
input, select, textarea { font: inherit; color: var(--testo); border: 1px solid #bfbfbf; border-radius: var(--raggio); padding: 5px 8px; min-height: 32px; background: #fff; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: #808080; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--blu); box-shadow: 0 0 0 1px var(--blu); }
input[type=checkbox] { width: auto; min-height: 0; accent-color: var(--blu); }
textarea { resize: vertical; min-height: 70px; }
label.campo, div.campo { display: block; margin-bottom: 12px; }
label.campo > span, div.campo > span { display: block; font-size: 12px; font-weight: 600; color: var(--grigio); margin-bottom: 4px; }
.riga { display: flex; gap: 10px; }
.riga > * { flex: 1; min-width: 0; }
.spunta { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; white-space: nowrap; }
.suggerimento { font-size: 12px; color: var(--grigio); margin: -6px 0 12px; }

/* intestazioni */
.intest { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.sotto { color: var(--grigio); margin-top: 3px; font-size: 13px; }
.strumenti { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.strumenti input, .strumenti select { width: auto; }
.strumenti input[type=search] { min-width: 240px; }
.strumenti .spazio { flex: 1; }

/* codifica ISO: composizione del codice e impostazioni */
.etichetta-campo { display: block; font-size: 12px; font-weight: 600; color: var(--grigio); margin-bottom: 4px; }
.compositore { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; padding: 10px; background: #fafafa; border: 1px solid var(--bordo-chiaro); border-radius: var(--raggio); }
.compositore label > span { display: block; font-size: 11px; color: var(--grigio); margin-bottom: 2px; }
.valore-fisso { min-height: 32px; display: flex; align-items: center; padding: 0 8px; background: #eee; border-radius: var(--raggio); font-weight: 600; }
.modale:has(.compositore) { max-width: 760px; }
.scheda-impostazioni { background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 20px 22px; max-width: 1000px; }
.griglia-elenchi { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 16px; }
.esempio-codice { display: inline-block; font-size: 15px; font-weight: 600; color: var(--blu-scuro); background: var(--blu-chiaro); padding: 4px 10px; border-radius: var(--raggio); }

/* trasmittal */
.tabella td.col-scelta { width: 34px; padding-right: 0; }
.lista-scelte { max-height: 220px; overflow: auto; border: 1px solid var(--bordo-chiaro); border-radius: var(--raggio); padding: 4px 8px; background: #fafafa; }
.riga-scelta { display: flex; padding: 4px 0; white-space: normal; }
.intest-trasmittal { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid var(--blu); padding-bottom: 10px; margin-bottom: 12px; }
.intest-trasmittal h2 { margin: 2px 0 0; }
@media print {
  .barra, .nav-strumenti, .no-stampa, #toast { display: none !important; }
  html, body, #app, .progetto, .progetto-corpo { height: auto; overflow: visible !important; background: #fff; display: block; }
  .scheda-impostazioni { border: 0; padding: 0; max-width: none; }
  .intest { margin-bottom: 8px; }
}

/* mappe dei progetti */
.contenitore.largo { max-width: 1600px; }
.progetti-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 42%); gap: 18px; align-items: start; }
.mappa-colonna { position: sticky; top: 0; }
.mappa-progetti { height: calc(100vh - 170px); min-height: 360px; border: 1px solid var(--bordo); border-radius: var(--raggio); background: #e8e8e8; }
.mappa-scelta { height: 260px; border: 1px solid var(--bordo); border-radius: var(--raggio); margin-bottom: 6px; background: #e8e8e8; }
.mappa-assente { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--grigio); padding: 20px; text-align: center; }
.segnaposto { background: none; border: 0; }
.segnaposto-pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--blu); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; }
.segnaposto-pin span { transform: rotate(45deg); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; }
.popup-progetto { min-width: 180px; font: 13px/1.4 "Segoe UI", system-ui, sans-serif; }
.popup-progetto b { display: block; font-size: 14px; margin: 2px 0; }
.popup-progetto a { display: inline-block; margin-top: 6px; font-weight: 600; }
.modale:has(.campi-luogo) { max-width: 640px; }
.riga-luogo > :first-child, .riga-luogo > :last-child { flex: 0 0 120px; }
@media (max-width: 1100px) {
  .progetti-layout { grid-template-columns: 1fr; }
  .mappa-colonna { position: static; order: -1; }
  .mappa-progetti { height: 340px; }
}

/* elenco progetti */
.progetto-nome { display: flex; align-items: center; gap: 12px; }
.progetto-icona { width: 32px; height: 32px; border-radius: var(--raggio); background: #e1ecf3; color: var(--blu-scuro); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; text-transform: uppercase; }

/* aree ISO 19650 della scheda tavole */
.aree { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.aree-nav { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 6px 0; position: sticky; top: 0; }
.area-voce { width: 100%; justify-content: space-between; text-align: left; padding: 9px 14px; border: 0; border-radius: 0; background: none; box-shadow: inset 3px 0 0 var(--c, transparent); }
.area-voce:hover { background: var(--sfondo); }
.area-voce b { display: block; font-weight: 600; }
.area-voce small { display: block; font-size: 11px; color: var(--grigio-chiaro); }
.area-voce.sel { background: var(--blu-chiaro); }
.area-voce.sel b { color: var(--blu-scuro); }
.area-num { font-weight: 600; font-size: 13px; color: var(--grigio); min-width: 26px; height: 22px; border-radius: 11px; background: var(--sfondo); display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.area-voce.sel .area-num { background: var(--blu); color: #fff; }
.aree-freccia { text-align: center; color: #c4c4c4; font-size: 11px; line-height: 1; }
.area-tutte { margin-top: 6px; border-top: 1px solid var(--bordo-chiaro); }
.area-WIP { --c: #8c8c8c; }
.area-CONDIVISO { --c: #f0a800; }
.area-PUBBLICATO { --c: var(--verde); }
.area-ARCHIVIATO { --c: #c4c4c4; }
/* cartelle di disciplina sotto l'area aperta */
.cartelle { display: flex; flex-direction: column; padding: 2px 0 6px; background: #fafafa; border-top: 1px solid var(--bordo-chiaro); border-bottom: 1px solid var(--bordo-chiaro); }
.cartella { width: 100%; justify-content: space-between; border: 0; border-radius: 0; background: none; min-height: 30px; padding: 4px 14px 4px 28px; font-size: 13px; color: var(--testo); text-align: left; }
.cartella span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cartella:hover { background: var(--blu-hover); }
.cartella.sel { background: var(--blu-chiaro); color: var(--blu-scuro); font-weight: 600; box-shadow: inset 3px 0 0 var(--blu); }
.cartella.vuota { color: var(--grigio-chiaro); }
.cartella-num { font-size: 12px; color: var(--grigio); min-width: 20px; text-align: right; }
.percorso { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 600; margin-bottom: 8px; color: #262626; }
.percorso button.link { font-size: 16px; font-weight: 600; color: var(--blu-scuro); }
.percorso .sep { color: var(--grigio-chiaro); }
.area-regola { background: #fff; border: 1px solid var(--bordo); border-left: 3px solid var(--c, var(--blu)); border-radius: var(--raggio); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; color: var(--grigio); }
.area-regola b { color: var(--testo); }
.tabella tr.gruppo td { background: #fafafa; font-weight: 600; font-size: 12px; color: var(--grigio); padding: 7px 12px; letter-spacing: .3px; }
.tabella td .tag + .tag { margin-left: 4px; }
@media (max-width: 1150px) {
  /* schermi stretti: le aree diventano una riga sopra la tabella */
  .aree { grid-template-columns: 1fr; gap: 12px; }
  .aree-nav { position: static; flex-direction: row; flex-wrap: wrap; padding: 0; }
  .area-voce { width: auto; flex: 1 1 150px; gap: 10px; box-shadow: inset 0 3px 0 var(--c, transparent); }
  .aree-freccia { display: none; }
  .area-tutte { margin-top: 0; border-top: 0; border-left: 1px solid var(--bordo-chiaro); }
  /* le cartelle dell'area aperta vanno a capo in una riga propria, come etichette */
  .cartelle { order: 10; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 6px 8px; border-bottom: 0; }
  .cartella { width: auto; padding: 3px 10px; border: 1px solid var(--bordo-chiaro); border-radius: 14px; background: #fff; gap: 8px; }
  .cartella.sel { box-shadow: none; border-color: var(--blu); }
}

/* tabelle */
.tabella-wrap { background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); overflow-x: auto; }
.tabella { width: 100%; border-collapse: collapse; }
.tabella th { text-align: left; font-weight: 600; font-size: 12px; color: var(--grigio); padding: 10px 12px; border-bottom: 1px solid var(--bordo); background: #fff; white-space: nowrap; }
.tabella td { padding: 10px 12px; border-bottom: 1px solid var(--bordo-chiaro); vertical-align: middle; }
.tabella tr:last-child td { border-bottom: 0; }
.tabella td.mono { white-space: nowrap; }
.tabella tr.clic { cursor: pointer; }
.tabella tr.clic:hover td { background: var(--blu-hover); }
.tabella td select { width: auto; min-height: 28px; padding: 2px 6px; }

/* etichette di stato: pallino colorato + testo */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 8px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #f0f0f0; color: #555; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.tag.rosso { background: #fdeaea; color: var(--rosso); }
.tag.rosso::before { display: none; } /* contatori: solo numero, il pallino è per gli stati */
.st-WIP { background: #f0f0f0; color: #595959; }
.st-CONDIVISO { background: #fff4d6; color: #9a6a00; }
.st-PUBBLICATO { background: #edf5e3; color: #4b7f16; }
.st-ARCHIVIATO { background: #f3f3f3; color: var(--grigio-chiaro); }
.si-aperta { background: #fdeaea; color: var(--rosso); }
.si-in_corso { background: #fef1df; color: #b36400; }
.si-risolta { background: #e6effc; color: var(--azzurro); }
.si-chiusa { background: #edf5e3; color: #4b7f16; }
.si-bozza { background: #f3e8f8; color: #7b1fa2; }
.si-annullata { background: #f0f0f0; color: var(--grigio-chiaro); text-decoration: line-through; }
.rv-in_attesa { background: #fef1df; color: #b36400; }
.rv-approvata { background: #edf5e3; color: #4b7f16; }
.rv-respinta { background: #fdeaea; color: var(--rosso); }
.rv-annullata { background: #f0f0f0; color: var(--grigio-chiaro); }
.pr-alta { color: var(--rosso); font-weight: 600; }
.pr-bassa { color: var(--grigio); }
.scaduta { color: var(--rosso); font-weight: 600; }
.disc { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; color: var(--grigio); }
.contatori { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.contatore { background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 10px 16px; min-width: 120px; }
.contatore b { display: block; font-size: 22px; font-weight: 600; color: #262626; }
button.contatore { display: block; text-align: left; font: inherit; min-height: 0; }
button.contatore:hover { border-color: var(--blu); background: #fff; }
button.contatore.sel { border-color: var(--blu); background: var(--blu-chiaro); box-shadow: inset 0 -3px 0 var(--blu); }
.contatore span { font-size: 12px; color: var(--grigio); }

/* accesso */
.accesso { max-width: 420px; margin: 8vh auto; background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 32px; box-shadow: var(--ombra); }
.accesso h1 { margin-bottom: 6px; }
.accesso p { color: var(--grigio); }
.accesso button { width: 100%; justify-content: center; min-height: 36px; }
.avviso { background: #fff8e6; border: 1px solid #f5d98b; padding: 10px 12px; border-radius: var(--raggio); font-size: 13px; margin-top: 14px; }

/* finestra modale */
.velo { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow: auto; }
.modale { background: #fff; border-radius: var(--raggio); width: 100%; max-width: 560px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.modale > header { padding: 16px 20px; border-bottom: 1px solid var(--bordo-chiaro); font-weight: 600; font-size: 17px; color: #262626; }
.modale > .corpo { padding: 18px 20px; }
.modale > footer { padding: 12px 20px; border-top: 1px solid var(--bordo-chiaro); display: flex; justify-content: flex-end; gap: 8px; background: #fafafa; }

#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
#toast div { background: #3c3c3c; color: #fff; padding: 10px 18px; border-radius: var(--raggio); box-shadow: var(--ombra); max-width: 90vw; border-left: 4px solid var(--verde); }
#toast div.err { border-left-color: var(--rosso); }

/* visualizzatore */
.viewer { display: flex; flex: 1; min-width: 0; height: 100%; }
.v-sx { width: 270px; flex: none; background: #fff; border-right: 1px solid var(--bordo); overflow: auto; padding: 16px; }
.v-dx { width: 360px; flex: none; background: #fff; border-left: 1px solid var(--bordo); overflow: auto; padding: 16px; }
.v-centro { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.v-barra { display: flex; gap: 4px; align-items: center; padding: 6px 10px; background: #fff; border-bottom: 1px solid var(--bordo); flex-wrap: wrap; min-height: 46px; }
.v-barra button { padding: 3px 10px; border-color: transparent; background: none; }
.v-barra button:hover { background: var(--sfondo); border-color: transparent; }
.v-barra button.primario { background: var(--blu); border-color: var(--blu); }
.v-barra button.primario:hover { background: var(--blu-scuro); }
.v-barra button.attivo { background: #fff4d6; border-color: var(--giallo); }
.v-barra .sep { width: 1px; height: 22px; background: var(--bordo); margin: 0 6px; }
.v-barra .v-pag, .v-barra .v-zoom { min-width: 54px; text-align: center; font-variant-numeric: tabular-nums; color: var(--grigio); }
.v-barra .spunta { font-size: 13px; color: var(--grigio); margin-left: 6px; }
.v-scroll { flex: 1; overflow: auto; background: #e3e3e3; position: relative; cursor: grab; user-select: none; }
.v-scroll.trascina { cursor: grabbing; }
.v-foglio { position: relative; margin: 24px auto; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2), 0 6px 20px rgba(0, 0, 0, .12); }
.v-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.v-overlay { position: absolute; inset: 0; }
.v-overlay.crea { cursor: crosshair; }
.v-schizzi { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.v-overlay.schizzo { cursor: crosshair; }
.v-overlay.schizzo .v-pin { pointer-events: none; }
.v-scroll.schizzo { touch-action: none; }
.v-barra-schizzo { background: #fffaf0; border-bottom-color: #f5d98b; }
.v-barra-schizzo .spazio { flex: 1; }
.v-barra-schizzo button.strumento { min-width: 34px; justify-content: center; font-size: 15px; padding: 3px 7px; }
.v-barra-schizzo button.strumento.attivo { background: var(--blu-chiaro); border-color: var(--blu); color: var(--blu-scuro); }
.v-barra-schizzo select { width: auto; min-height: 28px; padding: 2px 6px; }
.colore { width: 22px; height: 22px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid #fff !important; box-shadow: 0 0 0 1px var(--bordo); }
.colore:hover { box-shadow: 0 0 0 1px var(--testo); }
.colore.sel { box-shadow: 0 0 0 2px var(--testo); }
.v-testo { position: absolute; z-index: 6; width: auto; min-width: 160px; min-height: 0; padding: 0 3px; border: 1px dashed currentColor; border-radius: var(--raggio); background: rgba(255, 255, 255, .9); font-family: "Segoe UI", Arial, sans-serif; font-weight: 600; line-height: 1.15; }
.v-messaggio { color: var(--grigio); padding: 40px; text-align: center; }
/* visualizzatore 3D dei modelli IFC (viewer3d.js): occupa tutta l'area centrale */
.v3d { position: absolute; inset: 0; display: flex; flex-direction: column; cursor: default; }
.v3d-comandi .spazio { flex: 1; }
.v3d-info { font-size: 12px; color: var(--grigio); }
.v3d-sezione { background: #fffaf0; border-bottom-color: #f5d98b; gap: 10px; }
.v3d-sezione select { width: auto; min-height: 28px; padding: 2px 6px; }
.v3d-sezione input[type=range] { width: 240px; min-height: 0; padding: 0; border: 0; accent-color: var(--blu); }
.v3d-quota { min-width: 110px; font-size: 13px; color: var(--grigio); font-variant-numeric: tabular-nums; }
.v3d-area { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.v3d-tela, .v3d-tela canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.v3d-etichette { position: absolute; inset: 0; pointer-events: none; }
.v3d-misura { position: absolute; transform: translate(-50%, -130%); background: #d92d20; color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.v3d-pannello { position: absolute; background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); padding: 10px 12px; font-size: 13px; overflow: auto; user-select: text; }
.v3d-pannello-tit { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 6px; }
.v3d-pannello-tit button.link { font-size: 18px; line-height: 1; color: var(--grigio); }
.v3d-pannello-piede { margin-top: 6px; font-size: 12px; color: var(--grigio); }
.v3d-piani { top: 10px; left: 10px; width: 230px; max-height: calc(100% - 60px); }
.v3d-piani .spunta { display: flex; gap: 6px; align-items: center; padding: 2px 0; }
.v3d-legenda { left: 10px; bottom: 34px; width: 230px; max-height: calc(100% - 120px); font-size: 12px; padding: 8px 10px; }
.v3d-leg-voce { display: flex; gap: 7px; align-items: center; padding: 1px 0; line-height: 1.3; }
.v3d-leg-voce .piccolo { margin-left: auto; color: var(--grigio-chiaro); }
.v3d-leg-colore { flex: 0 0 auto; width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); }
.v3d-prop { top: 138px; right: 10px; width: 330px; max-height: calc(100% - 290px); min-height: 80px; }
/* puntatore secondo l'azione: ruota (freccia circolare), sposta, avvicina o allontana */
.v3d-tela canvas { cursor: grab; }
.v3d-tela.ruota canvas { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M19 12a7 7 0 1 1-2.1-5' stroke='%23fff' stroke-width='5'/%3E%3Cpath d='M19 12a7 7 0 1 1-2.1-5' stroke='%23222' stroke-width='2'/%3E%3C/g%3E%3Cpath d='M20 2v7h-7z' fill='%23222' stroke='%23fff' stroke-width='1'/%3E%3C/svg%3E") 12 12, grabbing; }
.v3d-tela.sposta canvas { cursor: move; }
.v3d-tela.avvicina canvas { cursor: zoom-in; }
.v3d-tela.allontana canvas { cursor: zoom-out; }
.v3d-perno { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border: 2px solid var(--blu); border-radius: 50%; background: rgba(6, 150, 215, .25); box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.v3d-perno::after { content: ''; position: absolute; left: 4px; top: 4px; width: 2px; height: 2px; background: var(--blu); border-radius: 50%; }
/* cubo di orientamento (come il ViewCube): facce CSS 3D ruotate come la camera */
.v3d-cubo { position: absolute; top: 8px; right: 10px; width: 120px; height: 122px; user-select: none; }
.v3d-cubo-scena { position: absolute; left: 0; top: 6px; width: 120px; height: 116px; }
.v3d-cubo-corpo { position: absolute; left: 25px; top: 23px; width: 70px; height: 70px; transform-style: preserve-3d; cursor: pointer; touch-action: none; }
.v3d-faccia { position: absolute; left: 0; top: 0; width: 70px; height: 70px; display: flex; align-items: center; justify-content: center; backface-visibility: hidden; background: rgba(248, 249, 250, .94); border: 1px solid #9aa4ae; color: #4a525a; font: 600 10px/1 "Segoe UI", Arial, sans-serif; text-transform: uppercase; letter-spacing: .3px; }
.v3d-faccia:hover { background: var(--blu-chiaro); color: var(--blu-scuro); border-color: var(--blu); }
.v3d-casa { position: absolute; left: 0; top: 0; z-index: 2; min-height: 0; width: 24px; height: 24px; padding: 0; font-size: 15px; line-height: 1; background: rgba(255, 255, 255, .9); border: 1px solid var(--bordo); }
/* tasti di movimento e barra di zoom */
.v3d-nav { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 12px; align-items: flex-end; background: rgba(255, 255, 255, .92); border: 1px solid var(--bordo); border-radius: var(--raggio); box-shadow: 0 2px 8px rgba(0, 0, 0, .12); padding: 6px 10px 8px; user-select: none; touch-action: none; }
.v3d-croce-tit { font-size: 10px; text-transform: uppercase; letter-spacing: .3px; color: var(--grigio); text-align: center; margin-bottom: 3px; }
.v3d-croce-tasti { display: grid; grid-template-columns: repeat(3, 26px); grid-auto-rows: 26px; gap: 2px; }
.v3d-croce-centro { border-radius: 50%; margin: 9px; background: var(--bordo); }
button.v3d-tasto { min-height: 0; width: 26px; height: 26px; padding: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; background: #fff; border: 1px solid var(--bordo); color: var(--testo); }
button.v3d-tasto:hover { background: var(--blu-chiaro); border-color: var(--blu); }
button.v3d-tasto:active { background: var(--blu); color: #fff; }
.v3d-zoom-corpo { display: flex; gap: 2px; height: 82px; }
.v3d-zoom-tasti { display: flex; flex-direction: column; justify-content: space-between; }
.v3d-zoom-col button.v3d-tasto { font-size: 15px; font-weight: 600; }
input.v3d-zoom { writing-mode: vertical-lr; direction: rtl; width: 22px; height: 82px; min-height: 0; padding: 0; margin: 0; border: 0; accent-color: var(--blu); box-shadow: none; }
.v3d-prop-nome { font-size: 14px; margin-bottom: 6px; word-break: break-word; }
.v3d-prop-tab { width: 100%; border-collapse: collapse; font-size: 12px; }
.v3d-prop-tab th { text-align: left; font-weight: normal; color: var(--grigio); padding: 2px 8px 2px 0; vertical-align: top; width: 45%; word-break: break-word; }
.v3d-prop-tab td { padding: 2px 0; word-break: break-word; }
.v3d-pset { margin-top: 8px; border-top: 1px solid var(--bordo-chiaro); padding-top: 6px; }
.v3d-pset summary { cursor: pointer; color: var(--blu); font-weight: 600; }
.v3d-avanzamento { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); width: min(420px, 80%); background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 16px 18px; text-align: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .12); }
.v3d-avanzamento.errore .v3d-testo { color: var(--rosso); margin-bottom: 12px; }
.v3d-testo { font-size: 13px; color: var(--grigio); }
.v3d-barra-av { height: 6px; background: var(--bordo-chiaro); border-radius: 3px; margin-top: 10px; overflow: hidden; }
.v3d-barra-av-pieno { height: 100%; width: 0; background: var(--blu); transition: width .15s; }
.v3d-guida { position: absolute; left: 10px; bottom: 8px; max-width: calc(100% - 330px); font-size: 11px; color: #555; background: rgba(255, 255, 255, .75); padding: 2px 8px; border-radius: 10px; pointer-events: none; }
/* modelli e altri file: scheda al centro del visualizzatore e sigla del tipo negli elenchi */
.v-file { max-width: 520px; margin: 60px auto; background: #fff; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 28px 30px; text-align: center; cursor: default; user-select: text; }
.v-file-tipo { display: inline-block; font: 600 22px/1 monospace; color: #fff; background: var(--grigio); padding: 14px 16px; border-radius: 4px; margin-bottom: 14px; }
.v-file-nome { font-weight: 600; word-break: break-all; margin-bottom: 4px; }
.v-file-descr { color: var(--grigio); font-size: 13px; line-height: 1.5; margin: 14px 0 18px; }
.tipo-file { display: inline-block; min-width: 30px; font: 600 9px/14px monospace; text-align: center; color: #fff; background: var(--grigio); border-radius: 2px; padding: 0 3px; vertical-align: 1px; }
.tf-pdf { background: var(--rosso); }
.tf-ifc { background: var(--verde); }
.tf-file { background: var(--azzurro); }
.v-guida { position: absolute; bottom: 14px; left: 50%; max-width: 90%; text-align: center; transform: translateX(-50%); background: #3c3c3c; color: #fff; padding: 7px 16px; border-radius: var(--raggio); font-size: 13px; z-index: 5; box-shadow: var(--ombra); pointer-events: none; border-left: 4px solid var(--giallo); }

.v-pin { position: absolute; transform: translate(-50%, -50%); min-width: 26px; height: 26px; min-height: 0; padding: 0 5px; border-radius: 13px; border: 2px solid #fff; background: var(--c); color: #fff; font-weight: 700; font-size: 12px; box-shadow: 0 1px 5px rgba(0, 0, 0, .45); cursor: pointer; justify-content: center; z-index: 2; }
.v-pin:hover { border-color: #fff; background: var(--c); transform: translate(-50%, -50%) scale(1.15); }
.v-area { position: absolute; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 10%, transparent); pointer-events: none; }
.s-aperta { --c: var(--rosso); }
.s-in_corso { --c: var(--arancio); }
.s-risolta { --c: var(--azzurro); }
.s-chiusa { --c: var(--verde); }
.s-bozza { --c: #7b1fa2; }
.s-annullata { --c: #9e9e9e; }
.v-area.s-bozza { border-style: dashed; }
.vecchia { opacity: .65; }
.v-pin.vecchia { border-style: dashed; }
.v-area.vecchia { border-style: dashed; }
.v-pin.sel { z-index: 3; box-shadow: 0 0 0 4px var(--giallo), 0 2px 8px rgba(0, 0, 0, .5); }
.v-area.sel { box-shadow: 0 0 0 3px var(--giallo); }

.v-doc-cod { font-family: Consolas, monospace; font-weight: 600; color: var(--blu-scuro); word-break: break-all; }
.v-doc-tit { font-weight: 600; margin: 2px 0 4px; font-size: 15px; color: #262626; }
.rev-lista { display: flex; flex-direction: column; gap: 4px; }
.rev-item { border: 1px solid var(--bordo-chiaro); border-radius: var(--raggio); padding: 7px 10px; cursor: pointer; display: block; width: 100%; text-align: left; background: #fff; min-height: 0; }
.rev-item:hover { border-color: var(--bordo); background: var(--blu-hover); }
.rev-item.sel { border-color: var(--blu); background: var(--blu-chiaro); box-shadow: inset 3px 0 0 var(--blu); }
.rev-item .r1 { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.rev-azioni { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.rev-azioni .riga { align-items: center; }
.box-approvazione { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--bordo); border-radius: var(--raggio); background: #fafafa; }
.box-approvazione > b { display: block; margin-bottom: 4px; }
.box-approvazione .piccolo { margin-bottom: 8px; }
.box-approvazione label.campo { margin: 8px 0; }
.box-approvazione.in-attesa { background: #fffaf0; border-color: #f5d98b; }
.storico-approvazioni { margin-top: 10px; font-size: 12px; }
.storico-approvazioni summary { cursor: pointer; color: var(--blu); margin-bottom: 6px; }
.storico-approvazioni > div { padding: 6px 0; border-top: 1px solid var(--bordo-chiaro); }
.nota-iso { margin-top: 12px; padding: 9px 11px; font-size: 12px; color: var(--grigio); background: var(--blu-hover); border-left: 3px solid var(--blu); border-radius: var(--raggio); }
.nota-iso b { color: var(--testo); }
.legenda { font-size: 12px; color: var(--grigio); margin-top: 18px; border-top: 1px solid var(--bordo-chiaro); padding-top: 10px; }
.legenda div { margin-bottom: 4px; }

.i-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 8px; border-bottom: 1px solid var(--bordo-chiaro); cursor: pointer; }
.i-item:hover { background: var(--blu-hover); }
.pallino { flex: none; min-width: 24px; height: 24px; border-radius: 12px; background: var(--c); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.i-tit { font-weight: 600; }
.i-meta { font-size: 12px; color: var(--grigio); }
.dett-tit { display: flex; gap: 8px; align-items: flex-start; margin: 12px 0 8px; }
.dett-tit h2 { margin: 0; flex: 1; }
.dett-tab { width: 100%; font-size: 13px; border-collapse: collapse; margin-bottom: 12px; }
.dett-tab td { padding: 4px 0; vertical-align: top; border-bottom: 1px solid #f3f3f3; }
.dett-tab td:first-child { color: var(--grigio); width: 118px; padding-right: 10px; }
.descr { white-space: pre-wrap; background: var(--sfondo); padding: 10px 12px; border-radius: var(--raggio); margin-bottom: 8px; }
.storico { border-left: 2px solid var(--bordo-chiaro); margin: 0 0 12px 6px; padding-left: 12px; }
.storico > div { margin-bottom: 10px; font-size: 13px; }
.storico .chi { font-weight: 600; }
.storico .quando { color: var(--grigio-chiaro); font-size: 11px; }
.storico .testo { white-space: pre-wrap; margin-top: 2px; }
.bottoni { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
details.modifica { margin-top: 14px; border-top: 1px solid var(--bordo-chiaro); padding-top: 10px; }
details.modifica summary { cursor: pointer; color: var(--blu); margin-bottom: 8px; }

/* aggiunte di Marco: miniature, campi vuoti, riferimenti, allegati, osservatori, pagina Utenti */
img.mini { width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--bordo); border-radius: 3px; flex: none; background: #fff; }
img.mini-grande { width: 100%; max-height: 220px; object-fit: contain; border: 1px solid var(--bordo); border-radius: var(--raggio); background: #fff; display: block; margin: 8px 0; }
.tit-mini { display: flex; gap: 10px; align-items: flex-start; }
.dett-stato { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.dett-stato .spazio { flex: 1; }
details.campi-vuoti { margin: 4px 0 10px; background: var(--sfondo); border-radius: var(--raggio); padding: 6px 10px; }
details.campi-vuoti summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--grigio); }
details.campi-vuoti .piccolo { margin-top: 4px; }
details.altri-campi { margin: 4px 0 12px; border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 6px 10px; }
details.altri-campi summary { cursor: pointer; color: var(--blu); margin-bottom: 4px; }
details.altri-campi[open] summary { margin-bottom: 10px; }
.sezione h3 { margin-top: 14px; }
.rif { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 3px 0; font-size: 13px; }
.rif a { text-decoration: none; }
.rif a:hover { text-decoration: underline; }
details.aggiungi summary { cursor: pointer; color: var(--blu); font-size: 13px; margin: 4px 0; }
.riga-compatta { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.riga-compatta select, .riga-compatta input { width: auto; flex: 1; min-width: 0; }
.allegati { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 8px; }
.allegato { font-size: 12px; min-width: 0; }
.allegato img, .allegato .pdf { width: 100%; height: 72px; object-fit: cover; border: 1px solid var(--bordo); border-radius: 3px; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--rosso); font-weight: 700; }
.allegato .nome-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
label.btn.carica { font-size: 13px; }
details.scelta-membri { border: 1px solid var(--bordo); border-radius: var(--raggio); background: #fff; }
details.scelta-membri summary { cursor: pointer; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.scelta-membri .lista { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--bordo); max-height: 180px; overflow: auto; }
details.scelta-membri .spunta { white-space: normal; }
.azioni-riga { white-space: nowrap; }
.azioni-riga button + button { margin-left: 12px; }
.azioni-utente { display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 330px; }
.progetto-utente { display: inline-flex; align-items: center; gap: 2px; margin: 0 8px 2px 0; white-space: nowrap; }
.progetto-utente button.link { padding: 0 3px; font-size: 14px; line-height: 1; }
.password-mostrata { font-size: 22px; letter-spacing: 2px; background: var(--sfondo); border: 1px dashed var(--bordo); padding: 12px; text-align: center; margin: 10px 0; user-select: all; }

@media (max-width: 1000px) {
  .viewer { flex-direction: column; overflow: auto; }
  .v-sx, .v-dx { width: auto; border: 0; border-bottom: 1px solid var(--bordo); }
  .v-centro { min-height: 70vh; }
  .marchio-testo small, .sel-etichetta { display: none; }
}
@media (max-width: 700px) {
  #app { padding: 14px; }
  .progetto-corpo { padding: 14px; }
  .nav-strumenti { width: 56px; }
  .nav-strumenti .nav-voce span { display: none; }
  .riga { flex-direction: column; gap: 0; }
  .marchio-testo { display: none; }
  .briciole { display: none; }
}
