/* style.css — CantieriDemo (mobile-first, tema chiaro/scuro, nessun font esterno) */

:root {
  --bg: #f4f2ef;
  --surface: #ffffff;
  --surface-2: #faf8f5;
  --text: #22252a;
  --muted: #6f7580;
  --border: #e6e1d9;
  --amber: #b45309;
  --amber-2: #d97706;
  --amber-soft: #fdf0dd;
  --verde: #15803d;
  --verde-soft: #e6f5ec;
  --rosso: #b91c1c;
  --rosso-soft: #fdeaea;
  --blu: #1d4ed8;
  --blu-soft: #e8eefc;
  --shadow: 0 1px 2px rgba(40, 30, 15, .05), 0 6px 18px rgba(40, 30, 15, .06);
  --radius: 14px;
  --nav-h: 62px;
}

[data-theme="dark"] {
  --bg: #131416;
  --surface: #1c1e21;
  --surface-2: #24272b;
  --text: #eceae7;
  --muted: #9ba1a9;
  --border: #2c3035;
  --amber: #f59e0b;
  --amber-2: #fbbf24;
  --amber-soft: #362709;
  --verde: #4ade80;
  --verde-soft: #12291b;
  --rosso: #f87171;
  --rosso-soft: #331515;
  --blu: #7aa2f7;
  --blu-soft: #17203a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  -webkit-tap-highlight-color: transparent;
}

.skip-link { position: absolute; left: -999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 21px; margin: 0; }
h2 { font-size: 15.5px; margin: 0; }
h3 { font-size: 14px; margin: 18px 0 8px; }
p { margin: 6px 0; }
a { color: var(--amber); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }

svg.ic, .btn svg, .riga-info svg, .card-footer svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 34px; height: 34px; flex: none; }
.brand-txt { display: flex; flex-direction: column; min-width: 0; }
.brand-txt strong { font-size: 15px; letter-spacing: .1px; }
.brand-txt span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.icon-btn:active { transform: scale(.95); }
.badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--rosso); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 18px;
  text-align: center;
}

select, input, textarea, button { font: inherit; color: inherit; }
select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
.ruolo-select {
  max-width: 128px;
  height: 38px; padding: 0 30px 0 10px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background-color: var(--surface-2);
  font-size: 13px; font-weight: 600;
}

/* ---------- Main / viste ---------- */
.app-main {
  flex: 1;
  width: 100%; max-width: 760px;
  margin: 0 auto;
  padding: 14px;
}
.view-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
}
.view-head .muted { font-size: 12.5px; margin: 3px 0 0; }

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
}
.card[data-action] { cursor: pointer; transition: transform .1s ease; }
.card[data-action]:active { transform: scale(.99); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-top h2, .card-top h3 { margin: 0; }
.card-footer {
  display: flex; align-items: center; gap: 14px;
  margin-top: 10px; padding-top: 9px;
  border-top: 1px dashed var(--border);
  font-size: 12.5px; color: var(--muted);
}
.card-footer span { display: inline-flex; align-items: center; gap: 5px; }
.card-footer .chev { margin-left: auto; }

.riga-info { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.riga-info.periodo { color: var(--text); }
.riga-info.badge-riga { flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Totali di periodo nel dettaglio cantiere (ritardo / giornate extra / ore) */
.riepilogo-periodi { display: flex; flex-wrap: wrap; gap: 7px; margin: -2px 0 12px; }

/* ---------- Chip / badge ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2.5px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap; flex: none;
}
.chip-verde { background: var(--verde-soft); color: var(--verde); }
.chip-ambra { background: var(--amber-soft); color: var(--amber); }
.chip-grigio { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.chip-blu { background: var(--blu-soft); color: var(--blu); }
.chip-rosso { background: var(--rosso-soft); color: var(--rosso); }
.chip-coda { background: var(--amber-soft); color: var(--amber); }
/* Giornate extra: distintivo rosso-ambra (ritardo economico) */
.chip-extra { background: var(--amber-soft); color: var(--rosso); box-shadow: inset 0 0 0 1px rgba(185, 28, 28, .3); }

/* ---------- Barre avanzamento ---------- */
.budget { margin-top: 10px; }
.budget-bar {
  height: 9px; border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}
.budget-bar span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--amber-2));
  transition: width .35s ease;
}
.budget-bar.ok span { background: linear-gradient(90deg, #15803d, #22c55e); }
.budget-bar.att span { background: linear-gradient(90deg, #b91c1c, #ef4444); }
.budget-bar.mini { height: 6px; }
.budget-testo { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px; }
.progress-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.progress-row .budget-bar { flex: 1; }
.progress-row .muted { font-size: 12px; white-space: nowrap; }

/* ---------- Pulsanti ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 42px; padding: 9px 14px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primario { background: var(--amber); color: #fff; }
[data-theme="dark"] .btn-primario { color: #20160a; }
.btn-outline { background: transparent; border-color: var(--border); }
.btn-quiet { background: transparent; color: var(--muted); font-weight: 500; }
.btn-danger { background: transparent; border-color: var(--border); color: var(--rosso); }
.btn.full { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 130px; }
.btn[disabled] { opacity: .55; pointer-events: none; }

/* ---------- Moduli ---------- */
label.campo { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
label.campo > span { display: block; margin-bottom: 5px; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"], textarea, .campo select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 16px; /* evita lo zoom automatico su iOS */
}
input[type="date"] { padding-right: 8px; }
textarea { min-height: 84px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, [role="button"]:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
.form-griglia { display: grid; gap: 0 12px; }
@media (min-width: 560px) { .form-griglia { grid-template-columns: 1fr 1fr; } }
.form-azioni { display: flex; gap: 8px; margin-top: 6px; }
.form-azioni .btn { flex: 1; }
.form-pagina .view-head { margin-bottom: 14px; }
.nota-form { font-size: 12px; color: var(--muted); margin-top: 10px; }

.select-filtro {
  width: 100%; min-height: 40px;
  margin-bottom: 12px;
  padding: 8px 30px 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  font-size: 13.5px; font-weight: 600;
}
.chips-filtro { display: flex; gap: 7px; margin-bottom: 12px; flex-wrap: wrap; }
.chips-filtro button {
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.chips-filtro button.attiva { background: var(--amber); border-color: var(--amber); color: #fff; }
[data-theme="dark"] .chips-filtro button.attiva { color: #20160a; }
/* Seconda fila di filtri: ritardo / giornate extra */
.chips-filtro-flag { margin-top: -5px; }

/* ---------- Mappa placeholder ---------- */
.mappa-box {
  position: relative;
  height: 150px;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(127,127,127,.13) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, rgba(127,127,127,.13) 23px 24px),
    var(--surface-2);
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 12px;
}
.mappa-box svg { width: 30px; height: 30px; fill: none; stroke: var(--amber); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mappa-box strong { color: var(--text); font-size: 13px; }

/* ---------- Foto ---------- */
.foto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
}
.foto-tile {
  position: relative;
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}
.foto-tile img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--surface-2); }
.foto-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 22px 8px 7px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78));
  color: #fff; font-size: 11px; line-height: 1.35;
}
.foto-cap strong { font-size: 11.5px; }
.foto-coda {
  position: absolute; top: 6px; left: 6px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(20, 16, 8, .82); color: #fbbf24;
  font-size: 10.5px; font-weight: 700;
}
.foto-coda svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2; }
.foto-grande { width: 100%; border-radius: 12px; display: block; margin-bottom: 12px; }

.geo-box {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px dashed var(--border);
  background: var(--surface-2);
  font-size: 13px; color: var(--muted);
  margin-bottom: 12px;
}
.geo-box.ok { border-style: solid; border-color: var(--verde); color: var(--verde); background: var(--verde-soft); }
.geo-box.err { border-style: solid; border-color: var(--rosso); color: var(--rosso); background: var(--rosso-soft); }
.geo-box button { margin-left: auto; }

/* ---------- Checklist ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.checklist li:last-child { border-bottom: none; }
.checklist label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; font-size: 14px; }
.checklist input[type="checkbox"] { width: 21px; height: 21px; accent-color: var(--amber); flex: none; }
.checklist .completata { text-decoration: line-through; color: var(--muted); }
.row-form { display: flex; gap: 8px; margin-top: 10px; }
.row-form input { flex: 1; }
.row-form .btn { flex: none; }

/* ---------- Prevenivo: righe voci ---------- */
.voce-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 10px;
  background: var(--surface-2);
}
.voce-card .voce-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.voce-card .voce-top strong { font-size: 12.5px; color: var(--muted); }
.voce-griglia { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.voce-griglia .descrizione { grid-column: 1 / -1; }
.voce-griglia input, .voce-griglia select { min-height: 42px; font-size: 15px; }
.tot-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 6px;
}
.tot-riga { display: flex; justify-content: space-between; font-size: 13.5px; padding: 3px 0; color: var(--muted); }
.tot-riga.grande { font-size: 16px; font-weight: 800; color: var(--text); border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }

/* ---------- Modale ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(15, 12, 8, .5);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: var(--surface);
  width: 100%; max-width: 560px;
  max-height: 88dvh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  animation: sali .18s ease;
}
@keyframes sali { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.modal-header h2 { font-size: 16px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-actions .btn { flex: 1; }
.modal-meta { font-size: 13px; color: var(--muted); margin: 0 0 12px; }
@media (min-width: 620px) {
  .modal-overlay { align-items: center; padding: 20px; }
  .modal { border-radius: 18px; padding-bottom: 18px; }
}

/* ---------- Tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none;
  color: var(--muted);
  font-size: 10.5px; font-weight: 600;
  cursor: pointer;
  padding: 6px 2px;
}
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab.attiva { color: var(--amber); }
.tab.attiva svg { stroke-width: 2; }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed; z-index: 80;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  left: 50%; transform: translateX(-50%);
  width: min(92vw, 430px);
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #26282c; color: #fff;
  padding: 11px 14px; border-radius: 12px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.visibile { opacity: 1; transform: none; }
.toast.ok { background: #166534; }
.toast.err { background: #991b1b; }

/* ---------- Stati vuoti ---------- */
.empty {
  text-align: center;
  padding: 38px 18px;
  color: var(--muted);
}
.empty svg { width: 42px; height: 42px; opacity: .5; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.empty p { margin: 10px 0 0; font-size: 13.5px; }

/* ---------- Documenti stampabili (report / preventivo) ---------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .btn { flex: 1; min-width: 140px; }

.doc {
  background: #ffffff;
  color: #1c1c1c;
  border: 1px solid #e4e0d8;
  border-radius: 14px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
}
.doc h3 {
  margin: 20px 0 8px;
  font-size: 12px; letter-spacing: .8px; text-transform: uppercase;
  color: #8a6a33;
  border-bottom: 1px solid #e7e2d8;
  padding-bottom: 4px;
}
.doc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 3px solid #b45309; padding-bottom: 12px; }
.doc-header .azienda { display: flex; gap: 10px; align-items: center; }
.doc-header svg.logo-doc, .doc-header img.logo-doc { width: 46px; height: 46px; flex: none; object-fit: contain; }
.doc-header .azienda strong { display: block; font-size: 14px; }
.doc-header .azienda span { display: block; font-size: 11px; color: #555; }
.doc-titolo { text-align: right; }
.doc-titolo strong { display: block; font-size: 16px; }
.doc-titolo span { font-size: 11.5px; color: #555; }
.doc-dati { display: grid; grid-template-columns: 1fr; gap: 2px 18px; font-size: 12.5px; margin-top: 10px; }
@media (min-width: 560px) { .doc-dati { grid-template-columns: 1fr 1fr; } }
.doc-dati div { padding: 3px 0; border-bottom: 1px dotted #e0dcd3; }
.doc-dati b { color: #6a6a6a; font-weight: 600; margin-right: 5px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc th { background: #f3efe7; text-align: left; padding: 7px; border-bottom: 1px solid #ddd6c8; }
.doc td { padding: 7px; border-bottom: 1px solid #eceae4; vertical-align: top; }
.doc .num { text-align: right; white-space: nowrap; }
.doc-foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc-foto-grid figure { margin: 0; }
.doc-foto-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid #e0dcd3; display: block; }
.doc-foto-grid figcaption { font-size: 10.5px; color: #444; margin-top: 4px; line-height: 1.35; }
.doc-nofoto { font-size: 12px; color: #777; padding: 10px 0; }
.doc-tot { margin-top: 10px; margin-left: auto; max-width: 320px; font-size: 12.5px; }
.doc-tot .riga { display: flex; justify-content: space-between; padding: 3px 0; }
.doc-tot .riga.finale { border-top: 2px solid #1c1c1c; margin-top: 5px; padding-top: 6px; font-weight: 800; font-size: 14px; }
.doc-note { font-size: 11.5px; color: #444; white-space: pre-wrap; background: #f7f4ee; border-radius: 8px; padding: 10px; }
.doc-firma { margin-top: 34px; padding-top: 10px; border-top: 1px dashed #bbb; font-size: 12px; display: flex; justify-content: space-between; gap: 20px; }

/* Modalità "solo documento": nasconde interfaccia anche a schermo */
body.solo-report .app-header,
body.solo-report .tabbar { display: none; }
body.solo-report .app-main { padding-top: 12px; }

/* ---------- Persone: operai, squadre, assegnazioni ---------- */
.punto-colore {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  flex: none; vertical-align: middle;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.chip-membro { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.campo-blocco { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.campo-blocco > span { display: block; margin-bottom: 5px; }

/* Selettore radio con opzioni occupate/disabilitate (pre-selezione conflitti) */
.picker { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.picker-opzione {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 14px; cursor: pointer;
}
.picker-opzione:last-child { border-bottom: none; }
.picker-opzione input[type="radio"] { width: 18px; height: 18px; accent-color: var(--amber); flex: none; }
.picker-testo { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.picker-testo strong { font-size: 14px; }
.picker-testo small { font-size: 11.5px; color: var(--muted); }
.picker-opzione.occupata { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.picker-opzione.occupata .punto-colore { opacity: .45; }
.occ-label { flex: none; font-size: 10.5px; padding: 3px 8px; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.check-inattivi {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--muted); margin-bottom: 12px; cursor: pointer;
}
.check-inattivi input { width: 18px; height: 18px; accent-color: var(--amber); flex: none; }

/* Modulo attività: "stessa data" + blocco date effettive/ore extra */
.check-stessa-data {
  display: flex; align-items: center; gap: 8px; grid-column: 1/-1;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.check-stessa-data input { width: 18px; height: 18px; accent-color: var(--amber); flex: none; }
.campi-effettivi { grid-column: 1/-1; padding-top: 12px; margin-top: 4px; border-top: 1px dashed var(--border); }

/* Elenco assegnazioni (raggruppate per data) e membri squadra */
.scheda-lista { list-style: none; margin: 0; padding: 0; }
.scheda-lista .data-gruppo {
  font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); padding: 12px 0 4px; margin: 0;
}
.membro-riga, .asg-riga {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.membro-riga:last-child, .asg-riga:last-child { border-bottom: none; }
.membro-riga .icon-btn, .asg-azioni { margin-left: auto; flex: none; }
.asg-azioni { display: flex; gap: 2px; }
.asg-info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.asg-info small { color: var(--muted); font-size: 12px; }

/* Messaggio di blocco (conflitti di assegnazione) */
.alert-errore {
  border: 1px solid var(--rosso); background: var(--rosso-soft); color: var(--rosso);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px;
}
.alert-errore ul { margin: 6px 0 0; padding-left: 18px; }
.alert-errore li { margin-top: 3px; }

.row-form select { flex: 1; }
.tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Accesso: login, sessione, cambio password ---------- */
.sessione-stato {
  font-size: 11px; font-weight: 600; color: var(--verde);
  background: var(--verde-soft); border-radius: 999px; padding: 4px 9px;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sessione-stato.offline { color: var(--amber); background: var(--amber-soft); }

.login-screen {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; overflow-y: auto;
  background: linear-gradient(160deg, var(--bg), var(--surface-2));
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow);
  padding: 22px 20px 20px;
}
.login-brand { text-align: center; margin-bottom: 16px; }
.login-brand .logo-login { width: 62px; height: 62px; margin-bottom: 8px; }
.login-brand h1 { font-size: 21px; margin: 0 0 4px; }
.login-brand p { font-size: 13px; margin: 0; }
.login-card .campo { margin-bottom: 12px; }
.campo-password { position: relative; display: block; }
.campo-password input { padding-right: 78px; }
.campo-password .icon-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: auto; height: 30px; padding: 0 10px; border-radius: 8px;
  font-size: 12px; font-weight: 600;
}
.login-errore {
  border: 1px solid var(--rosso); background: var(--rosso-soft); color: var(--rosso);
  border-radius: 11px; padding: 9px 11px; font-size: 13px; margin: 4px 0 12px;
}
.login-link { text-align: center; margin-top: 12px; }
.link-btn {
  background: none; border: none; color: var(--amber); cursor: pointer;
  font-size: 13px; font-weight: 600; text-decoration: underline; padding: 4px;
}
.login-nota { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.login-offline {
  text-align: center; font-size: 12px; color: var(--amber); margin: 8px 0 0;
  background: var(--amber-soft); border-radius: 8px; padding: 6px 8px;
}
body.in-login .app-main, body.in-login .tabbar { display: none; }

/* Password provvisoria (mostrata una sola volta) */
.pwd-box {
  display: flex; align-items: center; gap: 10px; margin: 12px 0;
  background: var(--surface-2); border: 1px dashed var(--amber); border-radius: 12px; padding: 12px;
}
.pwd-box code {
  flex: 1; font-size: 16px; font-weight: 700; letter-spacing: .5px;
  color: var(--text); word-break: break-all;
}
.nota-box {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--amber-soft); border-radius: 12px; padding: 10px 12px;
  font-size: 12.5px; line-height: 1.45; margin: 0 0 12px;
}
.nota-box .ic { flex: none; color: var(--amber); margin-top: 1px; }
.lista-passi { margin: 0 0 12px; padding-left: 20px; font-size: 14px; }
.lista-passi li { margin-bottom: 6px; }

/* ================= Vista "La mia squadra / I miei cantieri" (RF-02) ================= */
.squadra-testa {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px;
  border-left: 6px solid var(--amber);
}
.squadra-testa .punto-colore { width: 16px; height: 16px; }
.squadra-testa h1 { font-size: 18px; margin: 0; }
.squadra-testa .muted { font-size: 12.5px; margin: 3px 0 0; }
.sezione-titolo {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin: 16px 2px 8px;
}
.sezione-titolo .ic { width: 15px; height: 15px; }
.membro-lista { display: flex; flex-direction: column; gap: 8px; }
.membro-card {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px;
}
.membro-card .avatar {
  width: 38px; height: 38px; flex: none; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  font-weight: 700; font-size: 14px; color: var(--muted);
}
.membro-card .membro-info { min-width: 0; flex: 1; }
.membro-card .membro-info strong { display: block; font-size: 14px; }
.membro-card .membro-info .muted { font-size: 12px; }
.membro-card .tel {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 13px; font-weight: 600; color: var(--text);
  text-decoration: none;
}
.gdpr-nota { font-size: 11.5px; color: var(--muted); margin: 8px 2px 0; line-height: 1.4; }
.attivita-oggi {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 12px; margin-bottom: 8px;
}
.attivita-oggi .att-info { min-width: 0; flex: 1; }
.attivita-oggi .att-info strong { display: block; font-size: 14px; }
.attivita-oggi .att-info .muted { font-size: 12px; }
.attivita-oggi[data-action] { cursor: pointer; }
.attivita-oggi[data-action]:active { transform: scale(.99); }

/* ================= Pannello avvisi in-app (campanella) ================= */
.avviso {
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px; margin-bottom: 8px; background: var(--surface);
}
.avviso[data-action] { cursor: pointer; }
.avviso[data-action]:active { transform: scale(.99); }
.avviso.non-letta { border-left: 4px solid var(--amber); background: var(--amber-soft); }
.avviso .avviso-ic {
  width: 32px; height: 32px; flex: none; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
}
.avviso.non-letta .avviso-ic { background: var(--amber); color: #fff; }
.avviso .avviso-info { min-width: 0; flex: 1; }
.avviso .avviso-info p { margin: 0; font-size: 13.5px; line-height: 1.4; }
.avviso .avviso-info .muted { font-size: 11.5px; margin-top: 3px; }
.avviso .pallino {
  width: 9px; height: 9px; flex: none; border-radius: 999px; background: var(--amber); margin-top: 4px;
}
.avviso-azioni { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.avviso-azioni .btn { flex: 1; min-width: 130px; }

/* ---------- Clienti (RF-06) ---------- */
.ricerca-cliente { display: block; margin-bottom: 4px; }
.ricerca-cliente input { width: 100%; }
.card-inattiva { opacity: .68; }
.card-inattiva .card-top h3 { text-decoration: line-through; text-decoration-color: var(--muted); }
/* Campo con pulsante affiancato (es. selettore cliente + "Nuovo cliente"). */
.campo-con-bottone { display: flex; gap: 8px; align-items: stretch; }
.campo-con-bottone select { flex: 1; min-width: 0; }
.campo-con-bottone .btn { flex: none; white-space: nowrap; }

/* ---------- Ciclo preventivo → cantiere (RF-07) ---------- */
.barra-ciclo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 12px 0; padding: 10px 12px;
  background: var(--amber-soft); border: 1px solid var(--border); border-radius: 10px;
}
.barra-ciclo .btn { flex: none; }
.barra-ciclo .muted { font-size: 12px; }
.modal-azioni-colonna { flex-direction: column; }
.modal-azioni-colonna .btn { width: 100%; }

/* ---------- Dati azienda e profilo (RF-08) ---------- */
.logo-azienda-box {
  margin-top: 8px; display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px dashed var(--border); border-radius: 10px;
}
.logo-azienda-box img { max-width: 120px; max-height: 90px; object-fit: contain; }
.logo-vuoto { display: flex; align-items: center; gap: 10px; }
.logo-vuoto svg { width: 46px; height: 46px; flex: none; }
.separatore { border: none; border-top: 1px solid var(--border); margin: 18px 0 14px; }
.modal-meta { font-size: 13.5px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }

@media print {
  .no-print, .app-header, .tabbar, .toast-container, .modal-overlay, .toolbar { display: none !important; }
  body { background: #fff; padding: 0; }
  .app-main { max-width: none; padding: 0; margin: 0; }
  .view[hidden] { display: none !important; }
  .doc { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .doc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc-header svg.logo-doc .fondo { fill: #b45309 !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
