/* SELF PERIZIA — stessa identita' visiva dell'AppFoto (L.I.S.A. navy+oro),
 * mobile-first: la usa il CLIENTE dal proprio telefono. Condiviso con la
 * console staff (/selfp/). Branding: STUDIO (normale) + RAGUSA (grassetto). */
: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 40px; }

/* brand STUDIO RAGUSA: STUDIO normale spaziato, RAGUSA bold oro (come il sito) */
.brand { letter-spacing: 2px; font-weight: 400; color: var(--testo); }
.brand b { color: var(--oro); font-weight: 800; }
.brand-top { text-align: center; padding: 18px 0 4px; font-size: 1.25rem; }
.brand-sub { text-align: center; color: var(--muto); font-size: .8rem; letter-spacing: 1.5px;
             text-transform: uppercase; margin-bottom: 14px; }

header.top { display: flex; align-items: center; gap: 10px; padding: 10px 2px 14px; }
header.top h1 { font-size: 1.1rem; 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; }

.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; }

/* consensi (dichiarazione cliente) */
.consenso { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: .88rem; }
.consenso input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--oro); }
.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); }

/* checklist wizard */
.step { display: flex; align-items: center; gap: 12px; padding: 13px 4px;
        border-bottom: 1px solid #24406e; cursor: pointer; }
.step:last-child { border-bottom: none; }
.step .pallino { width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-weight: 800;
  background: #2c4a7c; color: #cfe2ff; font-size: .9rem; }
.step.fatto .pallino { background: var(--ok); color: #052813; }
.step .info { flex: 1; min-width: 0; }
.step .titolo { font-weight: 700; }
.step .dett { color: var(--muto); font-size: .8rem; }
.step .conta { font-size: .8rem; font-weight: 700; color: var(--muto); white-space: nowrap; }
.step.fatto .conta { color: var(--ok); }

.badge { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.badge.emessa    { background: #2c4a7c; color: #cfe2ff; }
.badge.in_corso  { background: #6b5817; color: #ffe9a8; }
.badge.inviata   { background: #1d3050; color: #cfe2ff; }
.badge.importata { background: #1d4030; color: #b9f2cf; }
.badge.annullata,
.badge.scaduta   { background: #4a1f24; color: #ffb9b9; }
.badge.verde  { background: #1d4030; color: #b9f2cf; }
.badge.giallo { background: #6b5817; color: #ffe9a8; }
.badge.rosso  { background: #4a1f24; color: #ffb9b9; }

/* griglia miniature */
.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 .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; }
.mini .flag { position: absolute; top: 4px; right: 4px; font-size: .85rem;
  background: rgba(0,0,0,.55); border-radius: 8px; padding: 1px 6px; }
.mini.scartata { opacity: .35; }

/* fotocamera fullscreen (stesso pattern AppFoto) */
.fotocamera { position: fixed; inset: 0; z-index: 60; background: #000; }
.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; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 24px;
  background: linear-gradient(rgba(0,0,0,.7), 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; flex: none; }
.fc-step { color: #fff; font-weight: 700; font-size: .92rem; text-align: center; flex: 1; }
.fc-contatore { color: #fff; font-weight: 700; background: rgba(0,0,0,.5);
  padding: 5px 12px; border-radius: 20px; font-size: .9rem; flex: none; }
.fc-hint { position: absolute; top: 76px; left: 12px; right: 12px; z-index: 2;
  background: rgba(0,0,0,.55); color: #ffe9a8; border-radius: 10px;
  padding: 8px 12px; font-size: .85rem; text-align: center; }
.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-fatto { background: rgba(0,0,0,.5); border: 1px solid var(--ok); color: #b9f2cf;
  font-size: .85rem; font-weight: 700; width: 92px; border-radius: 12px; padding: 10px 4px; }
.fc-spazio { width: 92px; flex-shrink: 0; }
.fc-lenti { width: 92px; flex-shrink: 0; background: rgba(0,0,0,.5); border: 1px solid var(--oro);
  color: var(--oro2); border-radius: 12px; padding: 8px 4px; font-size: 1.3rem; line-height: 1; }
.fc-lenti small { display: block; font-size: .6rem; font-weight: 700; margin-top: 3px; line-height: 1.15; }
/* zoom/grandangolo: due tasti grandi, niente slider */
.fc-zoom { position: absolute; left: 0; right: 0; bottom: calc(112px + env(safe-area-inset-bottom));
  z-index: 2; display: flex; gap: 10px; justify-content: center; }
.fc-zoom button { width: auto; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.5);
  color: #fff; font-size: .85rem; font-weight: 700; border-radius: 20px; padding: 8px 18px; margin: 0; }
.fc-zoom button.on { background: var(--oro); color: #1a1a1a; border-color: var(--oro); }
.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; }

/* overlay verifica/upload */
.velo { position: fixed; inset: 0; z-index: 80; background: rgba(4,12,25,.86);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.velo .box { background: var(--card); border-radius: 16px; padding: 20px; width: 100%;
  max-width: 420px; text-align: center; }
.velo .box h3 { color: var(--oro2); margin-bottom: 8px; }

.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); } }

/* console staff: 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; }
.pin-box { text-align: center; padding-top: 12vh; }
.pin-box input { text-align: center; font-size: 1.6rem; letter-spacing: .4em; }
.linkbox { background: var(--navy2); border: 1px dashed var(--oro); border-radius: 10px;
  padding: 10px; margin-top: 10px; font-size: .82rem; word-break: break-all; }
.flag-list { margin-top: 12px; }
.flag-row { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 2px; border-bottom: 1px solid #24406e; }
.flag-row:last-child { border-bottom: none; }
.flag-row .nome { font-size: .92rem; }
.flag-row .nome small { color: var(--muto); font-size: .72rem; margin-left: 4px; }
.toggle-invio { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.toggle-invio .lab { flex: 1; font-size: .92rem; }
.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); }
