/* APP FOTO PERIZIA — look L.I.S.A. navy+oro, mobile-first (Redmi Note 11: 393px) */
:root {
  --navy: #0a1f3c;
  --navy2: #12294d;
  --oro: #d4af37;
  --oro2: #f0cf6f;
  --testo: #eef2f8;
  --muto: #9fb0c8;
  --ok: #35c26a;
  --warn: #e8b83a;
  --err: #e05b5b;
  --card: #16305a;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--navy); color: var(--testo);
  font-size: 16px; line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 14px 90px; }

header.top {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 2px 14px;
}
header.top h1 { font-size: 1.15rem; color: var(--oro); font-weight: 700; letter-spacing: .5px; flex: 1; }
header.top .back { color: var(--oro); font-size: 1.6rem; background: none; border: none; padding: 2px 10px 2px 0; }
.sotto { color: var(--muto); font-size: .85rem; }

.card {
  background: var(--card); border-radius: 14px; padding: 14px;
  margin-bottom: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.card h2 { font-size: .95rem; color: var(--oro2); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }

button.bottone {
  display: block; width: 100%; padding: 15px; border: none; border-radius: 12px;
  background: var(--oro); color: #1a1a1a; font-size: 1.05rem; font-weight: 700;
  margin-top: 10px; cursor: pointer;
}
button.bottone.secondario { background: var(--navy2); color: var(--oro2); border: 1px solid var(--oro); }
button.bottone.pericolo { background: var(--err); color: #fff; }
button.bottone:disabled { opacity: .45; }

input, select, textarea {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #2c4a7c;
  background: var(--navy2); color: var(--testo); font-size: 1rem; margin-top: 4px;
}
textarea { min-height: 74px; }
label.campo { display: block; margin-top: 12px; font-size: .88rem; color: var(--muto); }
.riga2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pin-box { text-align: center; padding-top: 12vh; }
.pin-box img { width: 84px; margin-bottom: 14px; border-radius: 20px; }
.pin-box input { text-align: center; font-size: 1.6rem; letter-spacing: .4em; }

.msg { padding: 10px 12px; border-radius: 10px; margin-top: 10px; font-size: .92rem; display: none; }
.msg.err { background: #4a1f24; color: #ffb9b9; display: block; }
.msg.ok  { background: #1d4030; color: #b9f2cf; display: block; }
.msg.info{ background: #1d3050; color: #cfe2ff; display: block; }

/* elenco sessioni */
.sess {
  display: flex; align-items: center; gap: 10px; padding: 12px 4px;
  border-bottom: 1px solid #24406e; cursor: pointer;
}
.sess:last-child { border-bottom: none; }
.sess .info { flex: 1; min-width: 0; }
.sess .titolo { font-weight: 700; }
.sess .dett { color: var(--muto); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.aperta    { background: #2c4a7c; color: #cfe2ff; }
.badge.chiusa    { background: #6b5817; color: #ffe9a8; }
.badge.importata { background: #1d4030; color: #b9f2cf; }
.badge.pend      { background: #4a1f24; color: #ffb9b9; }

/* conferma lookup */
.lk { border: 1px solid var(--oro); border-radius: 12px; padding: 12px; margin-top: 10px; }
.lk b { color: var(--oro2); }
.lk .r { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-size: .95rem; }
.lk .r span:first-child { color: var(--muto); }

/* fotocamera + griglia */
.scatta-fissa {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-width: 560px; margin: 0 auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(10,31,60,.94) 30%);
}
.scatta-fissa button {
  width: 100%; padding: 17px; border-radius: 14px; border: none;
  background: var(--oro); color: #1a1a1a; font-size: 1.2rem; font-weight: 800;
}
.griglia { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.mini { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--navy2); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.mini .stato {
  position: absolute; top: 4px; right: 4px; font-size: .8rem;
  background: rgba(0,0,0,.55); border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.mini .num {
  position: absolute; bottom: 4px; left: 4px; font-size: .72rem; font-weight: 700;
  background: rgba(0,0,0,.55); border-radius: 6px; padding: 1px 6px;
}

/* fotocamera in-app: scatti continui, mai un'app esterna di mezzo */
.fotocamera { position: fixed; inset: 0; z-index: 60; background: #000; max-width: none; }
.fotocamera video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 24px;
  background: linear-gradient(rgba(0,0,0,.65), transparent);
}
.fc-chiudi {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); color: #fff; font-size: 1.2rem; line-height: 1;
}
.fc-contatore {
  color: #fff; font-weight: 700; background: rgba(0,0,0,.5);
  padding: 5px 14px; border-radius: 20px; font-size: .9rem;
}
#fc_msg { display: none; position: absolute; top: 60px; left: 12px; right: 12px; z-index: 2; }
.fc-bottom {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0,0,0,.7) 45%);
}
.fc-scatto {
  width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff;
  background: var(--oro); flex-shrink: 0;
}
.fc-scatto:active { background: var(--oro2); }
.fc-scatto:disabled { opacity: .6; }
.fc-annulla {
  background: none; border: none; color: #ffb3b3; font-size: .78rem; font-weight: 700;
  line-height: 1.25; width: 84px; text-align: left;
}
.fc-spazio { width: 84px; flex-shrink: 0; }
.fc-lenti {
  background: rgba(0,0,0,.5); border: 1px solid var(--oro); color: var(--oro2);
  font-size: .78rem; font-weight: 700; line-height: 1.25; width: 84px;
  border-radius: 12px; padding: 8px 4px; text-align: center; flex-shrink: 0;
}
.fc-lenti small { font-weight: 400; color: var(--muto); }
.fc-switch {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.5); color: #fff; font-size: 1.3rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fc-zoom {
  position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%); z-index: 2;
  display: none; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(0,0,0,.5); color: #fff; padding: 8px 16px; border-radius: 16px; font-size: .95rem;
}
.fc-zoom input[type=range] { width: 150px; accent-color: var(--oro); }
.fc-zpresets { display: flex; gap: 6px; }
.fc-zbtn {
  background: rgba(255,255,255,.18); color: #fff; border: none; border-radius: 14px;
  padding: 4px 11px; font-size: .8rem; font-weight: 700;
}
.fc-zbtn:active { background: var(--oro); color: #1a1a1a; }
.fc-flash {
  position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0;
  pointer-events: none; transition: opacity .12s ease-out;
}
.fc-flash.attivo { opacity: .85; }
.fc-anteprima {
  position: absolute; bottom: 108px; right: 16px; z-index: 3;
  width: 96px; height: 96px; object-fit: cover; border-radius: 10px;
  border: 2px solid var(--oro); box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

/* tag scatto 📄 LIBRETTO / 🔩 TELAIO (23/07/2026) */
.fc-tags {
  position: absolute; bottom: 120px; left: 0; right: 0; z-index: 2;
  display: flex; justify-content: center; gap: 8px; padding: 0 8px;
}
.fc-tag {
  border: 1.5px solid rgba(255,255,255,.55); background: rgba(10,25,49,.55);
  color: #fff; border-radius: 20px; padding: 8px 12px; font-size: .8rem;
  font-weight: 600; backdrop-filter: blur(2px); white-space: nowrap;
}
.fc-tag.attivo {
  background: var(--oro); border-color: var(--oro); color: #0a1931;
  box-shadow: 0 0 12px rgba(228,197,103,.65);
}
.mini .tagmini {
  position: absolute; top: 2px; left: 2px; font-size: .8rem;
  background: rgba(10,25,49,.65); border-radius: 6px; padding: 0 3px;
}

/* toggle flag */
.flag { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid #24406e; }
.flag:last-child { border-bottom: none; }
.flag .nome { font-size: .95rem; }
.flag .nome small { display: block; color: var(--muto); font-size: .76rem; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 30px; background: #2c4a7c; transition: .15s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .15s;
}
.switch input:checked + .slider { background: var(--oro); }
.switch input:checked + .slider::before { transform: translateX(22px); }

.toggle-invio { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.toggle-invio .lab { flex: 1; font-size: .92rem; }
.esito { font-size: .85rem; background: var(--navy2); border-radius: 10px; padding: 10px; margin-top: 10px; white-space: pre-wrap; word-break: break-word; }
.hide { display: none !important; }
.center { text-align: center; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid #2c4a7c; border-top-color: var(--oro); border-radius: 50%; animation: giro .8s linear infinite; vertical-align: middle; }
@keyframes giro { to { transform: rotate(360deg); } }
