/* Easy Azienda – modello grafico unico (MODELLO-GRAFICO.md) e regole 1-22 di ORGANIZZAZIONE.md. */
:root { --primario: #3b82f6; --primario-2: #2563eb; --verde: #16a34a; --rosso: #dc2626; --sfondo: #0e1116; --pannello: #161b22; --bordo: #2a323d; --testo: #e8edf3; --tenue: #9aa7b4; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--sfondo); color: var(--testo); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: #60a5fa; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 20px 0 8px; }
[hidden] { display: none !important; }

/* Tasti (regola 1: rettangolari con angoli curvi; regola 2: blu azione, verde acceso, rosso spento/principale) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; background: #1c222b; color: var(--testo); border-color: var(--bordo); text-decoration: none; }
.btn-primario { background: var(--primario); color: #fff; border-color: transparent; }
.btn-primario:hover { background: var(--primario-2); }
.btn-rosso { background: var(--rosso); color: #fff; border-color: transparent; }
.btn-piccolo { min-height: 30px; padding: 0 10px; font-size: .78rem; }
.btn[disabled], .btn.occupato { opacity: .75; cursor: progress; background: #475569; }
.tasti { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.tasti.centrati { justify-content: center; }
input.spunta { width: auto; min-height: auto; }

/* Testata e menu laterale (regola 17: una cosa per pagina) */
.testata { position: sticky; top: 0; z-index: 20; height: 64px; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--pannello); border-bottom: 1px solid var(--bordo); }
.hamburger { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--bordo); background: #1c222b; color: var(--testo); font-size: 1.3rem; cursor: pointer; }
.logo { color: var(--testo); font-weight: 800; text-decoration: none; font-size: 1.1rem; }
.menu { position: fixed; z-index: 30; top: 64px; left: 0; bottom: 0; width: min(85vw, 280px); overflow-y: auto; padding: 12px; background: var(--pannello); border-right: 1px solid var(--bordo); }
.menu .gruppo { margin: 14px 8px 6px; font-size: .8rem; color: var(--tenue); text-transform: uppercase; letter-spacing: .05em; }
.menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--testo); text-decoration: none; }
.menu a.scelta { background: var(--primario); color: #fff; }
.menu .versione { margin: 18px 12px 0; font-size: .8rem; color: var(--tenue); }
@media (min-width: 900px) {
  .hamburger { display: none; }
  .menu, .menu[hidden] { display: block !important; }
  main, .torna-su { margin-left: 280px; }
}

main { padding: 20px 16px; max-width: 980px; outline: none; }
.attesa { color: var(--tenue); }
.vuoto { padding: 28px; text-align: center; color: var(--tenue); background: var(--pannello); border: 1px dashed var(--bordo); border-radius: 12px; }
.riquadro { max-width: 560px; margin: 40px auto; padding: 22px; background: var(--pannello); border: 1px solid var(--bordo); border-radius: 12px; }
body.semplice main.riquadro { margin-left: auto; }

/* Caselle (MODELLO-GRAFICO.md 4): bordo blu, rosso solo per gli errori veri */
label { display: block; margin: 10px 0 4px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1.5px solid #3b82f6; background: #0b0f14; color: var(--testo); font: inherit; }
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { border-color: #60a5fa; outline: 2px solid rgba(59,130,246,.35); outline-offset: 1px; }
.sbagliato { border-color: var(--rosso) !important; }
.errore { color: #fca5a5; font-weight: 600; }
.conferma { color: #86efac; font-weight: 600; margin-left: 8px; }
fieldset { margin: 16px 0; padding: 12px 16px; border: 1px solid var(--bordo); border-radius: 12px; background: var(--pannello); }
legend { padding: 0 6px; font-weight: 700; }
.riga { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }

/* Elenchi e tabelle */
.elenco { list-style: none; padding: 0; margin: 0; }
.elenco li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; margin-bottom: 8px; background: var(--pannello); border: 1px solid var(--bordo); border-radius: 12px; }
.elenco .sotto { color: var(--tenue); font-size: .88rem; }
.tabella { width: 100%; border-collapse: collapse; margin: 10px 0; }
.tabella th, .tabella td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bordo); vertical-align: top; }
.etichetta { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: .78rem; font-weight: 700; }
.etichetta.acceso { background: var(--verde); color: #fff; }
.etichetta.spento { background: var(--rosso); color: #fff; }
.filtri { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 14px; }
.filtri > * { flex: 1 1 200px; }

/* Profilo a fisarmonica (regola 10) */
details { margin: 10px 0; background: var(--pannello); border: 1px solid var(--bordo); border-radius: 12px; }
summary { cursor: pointer; padding: 14px 16px; font-weight: 700; min-height: 44px; }
details > div { padding: 0 16px 14px; }
.versione-profilo { color: var(--tenue); font-size: .9rem; margin: 4px 0 14px; }

/* Condividi (regola 22) */
.qr { display: block; width: min(80vw, 320px); height: auto; margin: 12px auto; background: #fff; border-radius: 12px; image-rendering: pixelated; }
.link-condiviso { word-break: break-all; text-align: center; color: var(--tenue); }

/* Pie' solo sul telefono (regola 12) */
.piede { padding: 12px 16px 80px; text-align: center; font-size: .85rem; color: var(--tenue); }
@media (min-width: 900px) { .piede { display: none !important; } }

/* "Torna su" (MODELLO-GRAFICO.md 2) */
.torna-su { display: flex; justify-content: center; margin: 40px 0 0; padding-bottom: max(56px, calc(env(safe-area-inset-bottom) + 40px)); }

/* Messaggi di conferma in basso (MODELLO-GRAFICO.md 3) */
.avviso { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; width: min(92vw, 420px); max-width: none; box-sizing: border-box; padding: 16px 22px; border-radius: 12px; background: #0f2a4a; color: #fff; border: 1px solid #38bdf8; box-shadow: 0 10px 30px rgba(0,0,0,.55); text-align: center; font-size: 1.05rem; line-height: 1.4; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.avviso.visibile { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.avviso.errore-av { border-color: #f87171; background: #3b1212; }
.av-ico { font-size: 1.8rem; line-height: 1; }
.av-ico:empty { display: none; }
.av-testo { font-weight: 700; }
.av-ora { font-size: .8rem; font-weight: 500; color: #8fb3d9; letter-spacing: .03em; }
.av-x { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; padding: 4px 8px; }

/* Pop-up ufficiale "Nuova versione" (MODELLO-GRAFICO.md 1) */
.nuova-versione { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; flex-wrap: nowrap; align-items: center; justify-content: center; gap: 6px; width: min(92vw, 420px); box-sizing: border-box; padding: 22px 22px 20px; border-radius: 12px; background: #0f2a4a; color: #fff; border: 1px solid #38bdf8; box-shadow: 0 10px 30px rgba(0,0,0,.55); font-weight: 600; text-align: center; font-size: 1.05rem; line-height: 1.35; }
.nuova-versione[hidden] { display: none; }
.nv-ico { font-size: 2.2rem; line-height: 1; }
.nv-titolo { font-size: 1.2rem; font-weight: 800; margin-top: 2px; white-space: normal; }
.nv-ver { font-size: .8rem; color: #8fb3d9; letter-spacing: .04em; }
.nuova-versione .btn { width: 100%; margin-top: 12px; min-height: 48px; font-size: 1rem; border-radius: 12px; }

/* Finestra obbligatoria (inviti) */
.finestra-sfondo { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: #0e1116; }
.finestra { width: min(94vw, 460px); padding: 22px; background: var(--pannello); border: 1px solid #38bdf8; border-radius: 12px; }

/* Foto del profilo (regola 24): cerchio ben visibile, senza barre o bordi scuri */
.avatar { margin-left: auto; width: 44px; height: 44px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--primario); color: #fff; font-weight: 800; text-decoration: none; flex: none; }
.avatar img, .cerchio-grande img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cerchio-grande { width: 128px; height: 128px; border-radius: 50%; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--primario); color: #fff; font-size: 2.6rem; font-weight: 800; }
.foto-anteprima { display: flex; justify-content: center; margin: 8px 0; }
.foto-editor { display: flex; flex-direction: column; align-items: center; }
.foto-tela { width: 280px; height: 280px; max-width: 100%; border-radius: 12px; background: #0b0f14; touch-action: none; cursor: grab; }
.foto-zoom { flex: 1 1 140px; min-height: 44px; border: 0; background: none; padding: 0; }
.nascosto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.centrato { text-align: center; }
.sotto { color: var(--tenue); font-size: .88rem; }
.foto-editor .tasti { flex-wrap: nowrap; width: 100%; max-width: 320px; }
.salvato { align-self: center; color: #86efac; font-weight: 600; font-size: .9rem; }
.salvato.mai { color: var(--tenue); font-weight: 500; }
