/* © 2026 Cristian La Porta – RAPPORTINO HT – tutti i diritti riservati
   Pensato per il cantiere: tasti grandi (si usano coi guanti), contrasto alto (si legge al sole). */
:root {
  --fondo: #EEF1F4;
  --carta: #FFFFFF;
  --testo: #10141A;
  --tenue: #5A6573;
  --linea: #D5DBE2;
  --scuro: #10141A;
  --scuro2: #1B222C;
  --arancio: #F7941D;
  --arancio-t: #FDEBD3;
  --ciano: #33B9DB;
  --verde: #178A4C;
  --verde-t: #DDF3E6;
  --giallo-t: #FFF3C4;
  --rosso: #C62828;
  --rosso-t: #FBE3E3;
  --r: 14px;
  --basso: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fondo); color: var(--testo); }
body { font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.avvio { display: grid; place-items: center; height: 100vh; font-weight: 700; color: var(--tenue); }

/* ---------- testata */
.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; background: var(--scuro); color: #fff;
  border-bottom: 3px solid var(--arancio); }
.bar .logo { height: 34px; margin: 0 4px; }
.bar-t { flex: 1; min-width: 0; }
.bar .t1 { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .t2 { font-size: 14px; color: #B8C2CE; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-btn { width: 48px; height: 48px; border: 0; border-radius: 12px; background: var(--scuro2); color: #fff; display: grid; place-items: center; }

main { padding: 14px 14px calc(150px + var(--basso)); max-width: 760px; margin: 0 auto; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--tenue); margin: 22px 2px 8px; }

/* ---------- pulsanti */
.grande { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 60px;
  padding: 12px 16px; border: 2px solid var(--linea); border-radius: var(--r); background: var(--carta);
  font-weight: 700; font-size: 18px; text-align: center; }
.grande.primario { background: var(--arancio); border-color: var(--arancio); color: var(--scuro); }
.grande.scuro { background: var(--scuro); border-color: var(--scuro); color: #fff; }
.grande.verde { background: var(--verde); border-color: var(--verde); color: #fff; }
.grande.pericolo { color: var(--rosso); border-color: #EBC1C1; }
.grande:active, .tile:active, .riga:active, .tasto:active { transform: scale(.98); }
.fila { display: flex; gap: 10px; }
.fila > * { flex: 1; }

/* ---------- schede della home */
.scheda-r { display: block; width: 100%; text-align: left; background: var(--carta); border: 2px solid var(--linea);
  border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; }
.scheda-r .r1 { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 19px; }
.scheda-r .r2 { color: var(--tenue); font-size: 15px; margin-top: 2px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 99px;
  background: var(--fondo); color: var(--tenue); white-space: nowrap; }
.badge .ic { width: 15px; height: 15px; stroke-width: 2.4; }
.badge.inviato { background: var(--verde-t); color: var(--verde); }
.badge.bozza { background: var(--giallo-t); color: #7A5A00; }
.badge.notte { background: #202A36; color: #fff; }
.spazio { flex: 1; }

/* ---------- riquadri del rapportino */
.griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-height: 104px;
  padding: 12px; border: 2px solid var(--linea); border-radius: var(--r); background: var(--carta); text-align: left; }
.tile.largo { grid-column: 1 / -1; }
.tile .ic { width: 30px; height: 30px; color: var(--scuro); }
.tile .tt { font-weight: 700; font-size: 17px; }
.tile .ts { color: var(--tenue); font-size: 14px; line-height: 1.3; }
.tile .conta { position: absolute; top: 10px; right: 10px; min-width: 34px; height: 34px; padding: 0 8px; border-radius: 99px;
  background: var(--arancio); color: var(--scuro); font-weight: 800; display: grid; place-items: center; }
.tile .conta.zero { background: var(--fondo); color: var(--tenue); }
.tile.fatto { border-color: #9FD6B6; }

.avviso { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); background: var(--giallo-t);
  margin-bottom: 12px; font-size: 15px; }
.avviso.ok { background: var(--verde-t); }
.avviso.err { background: var(--rosso-t); }
.avviso button { border: 0; background: transparent; padding: 0; margin-left: auto; }

/* ---------- barra delle azioni in basso */
.azioni { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: var(--carta); border-top: 1px solid var(--linea);
  padding: 10px 12px calc(6px + var(--basso)); box-shadow: 0 -6px 18px rgba(16,20,26,.08); }
.azioni .fila { max-width: 760px; margin: 0 auto; }
.stato { max-width: 760px; margin: 6px auto 0; display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; color: var(--tenue); }
.stato .ic { width: 16px; height: 16px; }
.stato.ok { color: var(--verde); }
.stato.attesa { color: #8A6300; }
.stato.err { color: var(--rosso); }

/* ---------- liste a spunta */
.cerca { display: flex; align-items: center; gap: 8px; background: var(--carta); border: 2px solid var(--linea); border-radius: var(--r); padding: 0 12px; margin-bottom: 10px; }
.cerca input { flex: 1; border: 0; outline: 0; background: transparent; min-height: 54px; font-size: 18px; }
.riga { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 8px 12px; margin-bottom: 8px; text-align: left;
  background: var(--carta); border: 2px solid var(--linea); border-radius: var(--r); }
.riga .spunta { width: 32px; height: 32px; border-radius: 9px; border: 2px solid #AEB8C4; display: grid; place-items: center; flex: none; background: #fff; }
.riga .spunta .ic { width: 22px; height: 22px; stroke-width: 3; opacity: 0; }
.riga.on { border-color: var(--arancio); background: #FFF8EE; }
.riga.on .spunta { background: var(--arancio); border-color: var(--arancio); }
.riga.on .spunta .ic { opacity: 1; color: var(--scuro); }
.riga .rt { font-weight: 650; }
.riga .rs { font-size: 14px; color: var(--tenue); }
.riga.nuovo { border-style: dashed; color: var(--tenue); }

/* ---------- catalogo lavorazioni */
.cat { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat button { min-height: 66px; padding: 8px 10px; border-radius: 12px; border: 2px solid var(--linea); background: var(--carta);
  font-weight: 650; font-size: 15px; line-height: 1.2; text-align: left; }
.cat button.fatta { border-color: var(--arancio); background: #FFF8EE; }
.lav { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 8px; border-radius: var(--r);
  border: 2px solid var(--arancio); background: #FFF8EE; }
.lav .lt { font-weight: 700; }
.lav .ls { font-size: 15px; color: var(--tenue); margin-top: 2px; }

/* ---------- blocchi: chip e tastiera */
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 12px; border-radius: 99px; border: 2px solid var(--arancio);
  background: #FFF8EE; font-weight: 700; font-size: 17px; }
.chip .ic { width: 18px; height: 18px; }
.chip.sugg { border-style: dashed; border-color: #AEB8C4; background: var(--carta); color: var(--tenue); }
.display { margin: 14px 0 10px; min-height: 64px; padding: 10px 16px; border-radius: var(--r); background: var(--scuro); color: #fff;
  font-size: 32px; font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; }
.display .vuoto { font-size: 16px; font-weight: 400; color: #8D99A8; letter-spacing: 0; }
.tastiera { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tasto { min-height: 62px; border-radius: 12px; border: 2px solid var(--linea); background: var(--carta); font-size: 26px; font-weight: 700; }
.tasto.ok { grid-column: span 2; background: var(--arancio); border-color: var(--arancio); font-size: 20px; }
.tasto.pic { font-size: 20px; }

/* ---------- campi */
label.campo { display: block; margin: 12px 0; }
label.campo > span { display: block; font-size: 14px; font-weight: 650; color: var(--tenue); margin: 0 2px 4px; }
.campo input, .campo textarea, .campo select { width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid var(--linea); border-radius: 12px;
  background: var(--carta); font-size: 19px; }
.campo textarea { min-height: 120px; font-size: 17px; }
.campo input:focus, .campo textarea:focus { outline: 0; border-color: var(--arancio); }
.numero-grande { font-size: 30px !important; font-weight: 700; text-align: center; }
.passo { display: grid; grid-template-columns: 70px 1fr 70px; gap: 8px; }
.passo button { border-radius: 12px; border: 2px solid var(--linea); background: var(--carta); font-size: 30px; font-weight: 700; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.seg button { flex: 1 1 auto; min-height: 54px; padding: 8px 14px; border-radius: 12px; border: 2px solid var(--linea); background: var(--carta); font-weight: 650; }
.seg button.on { background: var(--scuro); border-color: var(--scuro); color: #fff; }
.totale { margin-top: 12px; padding: 14px; border-radius: var(--r); background: var(--scuro); color: #fff; display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; }

/* ---------- misure */
.misura { background: var(--carta); border: 2px solid var(--linea); border-radius: var(--r); padding: 10px; margin-bottom: 10px; }
.misura .mg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.misura input { width: 100%; min-height: 50px; padding: 6px 8px; border: 2px solid var(--linea); border-radius: 10px; font-size: 18px; text-align: center; background: #fff; }
.misura .md { width: 100%; text-align: left; margin-bottom: 6px; }
.misura small { display: block; font-size: 12px; color: var(--tenue); text-align: center; margin-bottom: 2px; }
.misura .mp { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; font-weight: 700; }
.misura .mp button { border: 0; background: transparent; color: var(--rosso); padding: 6px; }

/* ---------- documenti */
.doc { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--carta); border: 2px solid var(--linea); border-radius: var(--r); padding: 10px; margin-bottom: 10px; }
.doc img { width: 96px; height: 128px; object-fit: cover; border-radius: 8px; background: var(--fondo); }
.doc .dt { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.doc .campo { margin: 6px 0; }
.doc .campo input { min-height: 46px; font-size: 17px; }
.doc .dp { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--tenue); }
.doc .dp button { border: 0; background: transparent; color: var(--rosso); padding: 6px; }
.scatti { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scatti label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 96px; border-radius: var(--r);
  border: 2px solid var(--linea); background: var(--carta); font-weight: 700; text-align: center; padding: 8px; }
.scatti label .ic { width: 32px; height: 32px; }
.scatti input { display: none; }

/* ---------- firma */
.firma-box { background: #fff; border: 2px dashed #AEB8C4; border-radius: var(--r); touch-action: none; }
.firma-box canvas { display: block; width: 100%; height: 260px; }
.firma-img { background: #fff; border: 2px solid var(--linea); border-radius: var(--r); padding: 10px; text-align: center; }
.firma-img img { max-width: 100%; max-height: 200px; }

/* ---------- foglio che sale dal basso */
.velo { position: fixed; inset: 0; z-index: 50; background: rgba(16,20,26,.55); display: flex; align-items: flex-end; justify-content: center; }
.foglio-b { width: 100%; max-width: 760px; max-height: 90vh; overflow: auto; background: var(--fondo); border-radius: 20px 20px 0 0;
  padding: 16px 14px calc(16px + var(--basso)); }
.foglio-b h3 { margin: 4px 2px 12px; font-size: 20px; }
.scelte { display: grid; gap: 8px; margin-bottom: 14px; }
.scelte button { min-height: 58px; text-align: left; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--linea); background: var(--carta); }
.scelte button.on { border-color: var(--arancio); background: #FFF8EE; font-weight: 700; }
.scelte button small { display: block; color: var(--tenue); font-size: 14px; font-weight: 400; }

/* ---------- lettore QR */
.scan { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; flex-direction: column; }
.scan video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.scan .mirino { position: absolute; left: 50%; top: 38%; width: min(68vw, 320px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 4px solid var(--arancio); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.scan .pannello { background: var(--scuro); padding: 12px 14px calc(12px + var(--basso)); }
.scan .msg { min-height: 28px; font-weight: 700; font-size: 18px; text-align: center; margin-bottom: 8px; }
.scan .msg.ok { color: #7EE2A8; } .scan .msg.err { color: #FF9C9C; }
.scan ul { list-style: none; margin: 0 0 10px; padding: 0; max-height: 22vh; overflow: auto; font-size: 15px; color: #C9D2DC; }
.scan li { padding: 4px 0; border-bottom: 1px solid #2A3440; }

/* ---------- avvisi a comparsa */
#toast { position: fixed; left: 50%; bottom: calc(150px + var(--basso)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 70;
  background: var(--scuro); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 650; pointer-events: none; transition: .2s; max-width: 90vw; text-align: center; }
#toast.vis { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- accesso */
.accesso { max-width: 420px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top, 0px)) 20px 30px; }
.accesso .testa { background: var(--scuro); color: #fff; border-radius: 20px; padding: 22px; text-align: center; border-bottom: 4px solid var(--arancio); margin-bottom: 18px; }
.accesso .testa img { height: 56px; }
.accesso .testa div { font-size: 24px; font-weight: 800; margin-top: 10px; }
.errore { color: var(--rosso); font-weight: 650; min-height: 24px; margin: 8px 2px; }
.copy { text-align: center; font-size: 12px; color: var(--tenue); margin-top: 24px; }

/* ---------- stampa: la pagina A4 sta in stampa.css (la usa anche il pannello) */
/* ---------- orari, foto in più, segnalazioni, promemoria (26/10/2026) */
.orario-sq { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--carta); border: 2px solid var(--linea);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 12px; font-weight: 650; }
.orario-sq > span { flex: 1 1 60%; color: var(--tenue); font-size: 15px; }
.orario-sq input { flex: 1 1 30%; min-height: 54px; font-size: 21px; font-weight: 700; text-align: center; border: 2px solid var(--linea);
  border-radius: 12px; padding: 4px 6px; background: #fff; }
.orario-sq b { color: var(--tenue); }
.riga-ore { display: flex; gap: 8px; align-items: stretch; }
.riga-ore .riga { flex: 1; min-width: 0; }
.riga-ore .ore { display: none; flex: 0 0 auto; align-items: center; gap: 4px; margin-bottom: 8px; padding: 0 10px; border-radius: var(--r);
  border: 2px solid var(--linea); background: var(--carta); font-size: 14px; font-weight: 650; color: var(--tenue); }
.riga-ore:has(.riga.on) .ore { display: flex; }
.riga-ore .ore .ic { width: 18px; height: 18px; }
.riga-ore .ore.diverso { border-color: var(--arancio); background: #FFF8EE; color: var(--scuro); }
.foto-btn { margin: 4px 0 10px; }
.foto-btn input { display: none; }
.foto-btn .grande { font-size: 16px; min-height: 58px; }
.scatti.galleria label { min-height: 70px; font-weight: 600; color: var(--tenue); }
.mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.mini .m { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; background: var(--fondo); border: 2px solid var(--linea);
  display: grid; place-items: center; font-size: 12px; color: var(--tenue); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini button { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(16,20,26,.72); color: #fff; display: grid; place-items: center; }
.mini button .ic { width: 18px; height: 18px; }
details.facoltativi { margin-top: 12px; background: var(--carta); border: 2px solid var(--linea); border-radius: var(--r); padding: 2px 12px 8px; }
details.facoltativi summary { min-height: 50px; display: flex; align-items: center; font-weight: 650; color: var(--tenue); cursor: pointer; }
.avviso > div { flex: 1; }
.avviso.forte { border: 2px solid var(--rosso); }
.avviso.forte > .ic { color: var(--rosso); }
.avviso .grande { border-width: 2px; border-style: solid; padding: 0 12px; margin-left: 0; min-height: 56px; }
.avviso .grande:not(.primario):not(.scuro) { background: var(--carta); border-color: var(--linea); }
.grande.segnala { padding: 0 16px; width: auto; }   /* largo quanto la scritta: con width 100% su iPhone spingeva Invia fuori dallo schermo */
.chip.on { border-color: var(--arancio); background: #FFF8EE; font-weight: 700; }

/* ---------- valori a scelta nelle lavorazioni (27/10/2026) */
.campo-scelta { margin: 12px 0; }
.campo-scelta > span { display: block; font-size: 14px; font-weight: 650; color: var(--tenue); margin: 0 2px 6px; }
.campo-scelta .seg { margin: 0 0 6px; }
.campo-scelta .campo { margin: 0; }
@media print {
  body { background: #fff; }
  .bar, .azioni, #toast, .non-stampa { display: none !important; }
  main, .anteprima { padding: 0 !important; margin: 0 !important; max-width: none !important; }
}
