/* Flyerbox · Volantino GPS - stili del PANNELLO (tutte le pagine tranne l'app dell'operatore).
   Stessa palette e stessi componenti degli altri due progetti Flyerbox: chi passa da
   mappe.flyerbox.it a volantino.flyerbox.it a gps.flyerbox.it deve sentirsi nello stesso prodotto.
   Regole mobile vincolanti in ARCHITECTURE.md §16: punti di rottura 720 e 900, bersagli >= 44px,
   campi a 16px, tutte le media query con "screen and", mai selettori di elemento nudi.

   ATTENZIONE AL NOME: questo file si chiama app.css perche' e' il foglio dell'APPLICAZIONE.
   Il 23/08/2026 e' stato sovrascritto per sbaglio dal CSS della pagina di scaricamento dell'APK
   (ora in scarica-app.css) e il pannello e' andato online senza stile. Se serve un foglio per una
   pagina nuova, NON chiamarlo app.css. */
:root {
  --arancio: #ff4d01;  --arancio-scuro: #d84100;  --arancio-soft: #fff1ea;
  --scuro: #232323;    --scuro-2: #2f2f2f;
  --bg: #f5f5f4;       --bianco: #ffffff;  --muted: #737373;
  --ok: #16a34a;       --ok-soft: #e7f7ec;
  --err: #dc2626;      --err-soft: #fdeeee;
  --warn: #f59e0b;     --warn-soft: #fff7e6;
  --info: #1e88e5;     --info-soft: #e8f2fd;
  --viola: #8e24aa;    --viola-soft: #f6ebf9;
  --line: #e5e5e5;     --radius: 10px;
  --shadow: 0 8px 28px rgba(0,0,0,.16);  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.4 var(--font); background: var(--bg); color: var(--scuro);
       -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 20px; } .h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 15px; }
a { color: var(--arancio); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.err-text { color: var(--err); }
.ok-text { color: var(--ok); }
.spacer { flex: 1; }

/* --- pulsanti --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: var(--bianco); color: var(--scuro); font-weight: 600; font-size: 14px;
  font-family: inherit; text-decoration: none; line-height: 1.2; }
.btn:hover { border-color: #d4d4d4; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--arancio); outline-offset: 1px; }
.btn.primary { background: var(--arancio); color: #fff; border-color: var(--arancio); }
.btn.primary:hover { background: var(--arancio-scuro); border-color: var(--arancio-scuro); }
.btn.dark { background: var(--scuro); color: #fff; border-color: var(--scuro); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn.icon { padding: 0; width: 36px; height: 36px; }
.btn.block { width: 100%; }
.btn:disabled, .btn.busy, .btn.disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

/* --- campi --- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; min-height: 38px; font: inherit; background: var(--bianco); color: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none;
  border-color: var(--arancio); box-shadow: 0 0 0 3px rgba(255,77,1,.15); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .with-btn { display: flex; gap: 6px; }
.field .with-btn input { flex: 1; min-width: 0; }
.field .with-btn .btn { flex: none; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--arancio); width: 16px; height: 16px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 > *, .grid-3 > * { min-width: 0; }

/* --- badge e pastiglie --- */
.badge { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 11px;
  font-weight: 700; background: #eee; color: #555; white-space: nowrap; }
.badge.ok, .badge.on, .badge.attiva { background: var(--ok-soft); color: var(--ok); }
.badge.off, .badge.chiusa { background: #eee; color: #666; }
.badge.orange { background: var(--warn-soft); color: #b45309; }
.badge.red { background: var(--err-soft); color: var(--err); }
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.viola { background: var(--viola-soft); color: var(--viola); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px;
  background: var(--bianco); cursor: pointer; font-family: inherit; }
.chip.on { background: var(--arancio); color: #fff; border-color: var(--arancio); }

/* --- barra in alto --- */
.topbar { position: sticky; top: 0; z-index: 1200; height: 56px; display: flex; align-items: center;
  gap: 14px; padding: 0 16px; background: var(--scuro); color: #fff; }
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.topbar .brand img.logo { height: 26px; display: block; }
.topbar .title { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #bdbdbd;
  padding-left: 12px; border-left: 1px solid #444; white-space: nowrap; }
.topbar .nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.topbar .nav a { color: #ddd; text-decoration: none; padding: 7px 11px; border-radius: 7px;
  font-weight: 600; white-space: nowrap; }
.topbar .nav a:hover { background: #383838; color: #fff; }
.topbar .nav a.on { color: var(--arancio); background: #1a1a1a; }
.topbar .btn { background: #383838; border-color: #4a4a4a; color: #fff; }
.topbar .btn:hover { background: #4a4a4a; }
.dd { position: relative; }
.dd .menu { display: none; position: absolute; right: 0; top: 44px; background: #fff; color: var(--scuro);
  border-radius: 10px; box-shadow: var(--shadow); min-width: 210px; padding: 8px; z-index: 2500; }
.dd.open .menu { display: block; }
.dd .menu .who { padding: 8px 10px; font-weight: 700; }
.dd .menu hr { border: none; border-top: 1px solid var(--line); margin: 6px 0; }
.dd .menu button, .dd .menu a { display: block; width: 100%; text-align: left; border: none;
  background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font: inherit;
  color: inherit; text-decoration: none; }
.dd .menu button:hover, .dd .menu a:hover { background: var(--bg); }

/* --- pagina, card, tabelle --- */
.page { max-width: 1280px; margin: 0 auto; padding: 20px 18px 60px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { flex: 1; }
.page-head input[type="search"] { border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: inherit; min-height: 36px; }
.card { background: var(--bianco); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  border: 1px solid var(--line); margin-bottom: 16px; overflow: hidden; }
.card.pad { padding: 16px; }
.card .bar { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card .bar h2 { flex: 1; }
.card .bar input, .card .bar select { border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 9px; font: inherit; min-height: 34px; background: var(--bianco); }
.card .bd { padding: 14px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { position: sticky; top: 0; background: #fafafa; text-align: left; font-size: 11px;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 7px 10px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.table tr.click { cursor: pointer; }
.table tr.click:hover { background: var(--arancio-soft); }
.table td.empty { text-align: center; color: var(--muted); padding: 28px; }

/* --- statistiche e avanzamento --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--bianco); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; }
.stat .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700;
  color: var(--muted); margin-top: 2px; }
.stat.accent { border-color: var(--arancio); }
.stat.ok .v { color: var(--ok); }
.progress { height: 8px; background: #eee; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--arancio); transition: width .3s; }
.progress.big { height: 14px; }
.progress.ok > i { background: var(--ok); }

/* --- modale --- */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bianco); border-radius: 14px; box-shadow: var(--shadow); width: 100%;
  max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; animation: pop .15s; }
.modal.wide { max-width: 860px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal header { display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); }
.modal header h2 { flex: 1; }
.modal .close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 0 4px; }
.modal .body { padding: 16px; overflow: auto; }
.modal footer { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px;
  border-top: 1px solid var(--line); flex-wrap: wrap; }

/* --- toast --- */
#toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 4000;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--scuro); color: #fff; padding: 10px 16px; border-radius: 10px;
  box-shadow: var(--shadow); font-weight: 600; font-size: 13px; max-width: 90vw; }
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

/* --- pallini di stato: codice colore fisso in tutto il prodotto (ARCHITECTURE §11.1) --- */
.pallino { display: inline-block; width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: #bbb; }
.pallino.verde { background: var(--ok); }
.pallino.giallo { background: #eab308; }
.pallino.arancione { background: var(--warn); }
.pallino.rosso { background: var(--err); }
.pallino.grigio { background: #bdbdbd; }
.pallino.blu { background: var(--info); }
.pallino.viola { background: var(--viola); }

/* --- riquadro informativo arancio tratteggiato --- */
.nota { background: var(--arancio-soft); border: 1px dashed var(--arancio); border-radius: 10px;
  padding: 12px 14px; font-size: 13px; margin-bottom: 16px; }
.nota.legge { background: var(--warn-soft); border-color: var(--warn); }
.nota > b:first-child { display: block; margin-bottom: 4px; }

/* --- vuoto --- */
.vuoto { text-align: center; padding: 40px 20px; color: var(--muted); }
.vuoto .big { font-size: 34px; margin-bottom: 8px; }

/* --- visore delle foto (usato in piu' pagine) --- */
.visore { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 5000; display: flex;
  align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 20px; }
.visore .cornice { position: relative; max-width: 92vw; max-height: 80vh; }
.visore .cornice img { display: block; max-width: 92vw; max-height: 80vh; border-radius: 10px; }
.visore .overlay { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 12px;
  background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,0));
  border-radius: 0 0 10px 10px; color: #fff; text-align: left; }
.visore .overlay .indirizzo { font-size: 16px; font-weight: 700; line-height: 1.3; }
.visore .overlay .meta { font-size: 12px; color: #d4d4d4; margin-top: 3px; }
.visore .info { color: #ddd; font-size: 13px; text-align: center; }

@media screen and (max-width: 900px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 720px) {
  .page { padding: 14px 12px 60px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn.primary, .btn.danger { min-height: 44px; }
  .btn.icon { width: 44px; height: 44px; }
  .check { min-height: 40px; }
  .check input { width: 20px; height: 20px; }
  .page input, .page select, .page textarea,
  .modal input, .modal select, .modal textarea { font-size: 16px; min-height: 44px; }
  .card .bar input, .card .bar select { font-size: 16px; min-height: 44px; }
  .table { width: max-content; min-width: 100%; }
  .table th:first-child, .table td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
  .table thead th { z-index: 3; }
  .table tr.click td { height: 44px; }
  .modal, .modal.wide { width: 100%; max-width: none; max-height: none; height: 100%;
    border-radius: 0; }
  .modal-back { padding: 0; }
  .modal footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }
  .topbar { padding: 0 10px; gap: 8px; }
  .topbar .title { display: none; }
}
