/* Asta Scout - webapp immobili (lista + mappa). Tema chiaro/scuro via
   variabili CSS; tutto il movimento e' CSS (transizioni, keyframes), nessuna
   libreria di animazione. */

:root {
  color-scheme: light;
  --sfondo: #f4f6fb;
  --superficie: #ffffff;
  --superficie-2: #f8fafc;
  --bordo: #e2e8f0;
  --bordo-forte: #cbd5e1;
  --testo: #0f172a;
  --testo-2: #475569;
  --muto: #94a3b8;
  --accento: #2563eb;
  --accento-forte: #1d4ed8;
  --accento-tenue: #dbeafe;
  --asta: #d97706;
  --asta-tenue: #fef3c7;
  --ok: #16a34a;
  --ok-tenue: #dcfce7;
  --warn: #d97706;
  --warn-tenue: #fef3c7;
  --errore: #dc2626;
  --errore-tenue: #fee2e2;
  --report: #7c3aed;
  --report-tenue: #ede9fe;
  --ombra: 0 1px 2px rgb(15 23 42 / .06), 0 4px 14px rgb(15 23 42 / .06);
  --ombra-forte: 0 8px 30px rgb(15 23 42 / .18);
  --raggio: 14px;
  --raggio-sm: 9px;
  --topbar-h: 64px;
  --filtri-h: 56px;
  --font: "Inter", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tempo: 180ms;
  --curva: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --sfondo: #0b1220;
  --superficie: #111a2e;
  --superficie-2: #16213a;
  --bordo: #223052;
  --bordo-forte: #2e3f66;
  --testo: #e6edf7;
  --testo-2: #a9b8d1;
  --muto: #6b7a99;
  --accento: #60a5fa;
  --accento-forte: #3b82f6;
  --accento-tenue: #1e3a8a;
  --asta: #fbbf24;
  --asta-tenue: #5a3b05;
  --ok: #4ade80;
  --ok-tenue: #14532d;
  --warn: #fbbf24;
  --warn-tenue: #5a3b05;
  --errore: #f87171;
  --errore-tenue: #5b1c1c;
  --report: #a78bfa;
  --report-tenue: #3b2a6e;
  --ombra: 0 1px 2px rgb(0 0 0 / .4), 0 4px 14px rgb(0 0 0 / .35);
  --ombra-forte: 0 8px 30px rgb(0 0 0 / .6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--testo);
  background: var(--sfondo);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--accento); }
button { font: inherit; color: inherit; }
input, select { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--superficie-2); padding: 1px 5px; border-radius: 5px; border: 1px solid var(--bordo); }
[hidden] { display: none !important; }
/* Icone: 1.1em. Esclusi i livelli vettoriali di Leaflet (bolle della mappa), che hanno le misure calcolate dalla mappa. */
svg:where(:not(.leaflet-pane *)) { width: 1.1em; height: 1.1em; flex: none; }

/* ---------- topbar ---------- */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--superficie);
  border-bottom: 1px solid var(--bordo);
  position: relative;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: none; }
.brand-logo {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accento), #7c3aed);
  color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 16px rgb(37 99 235 / .35);
}
.brand-logo svg { width: 20px; height: 20px; }
.brand-nome { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.brand-nome b { font-weight: 800; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: transform var(--tempo) var(--curva), background var(--tempo), box-shadow var(--tempo), opacity var(--tempo);
  position: relative;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primario { background: var(--accento); color: #fff; box-shadow: 0 6px 16px rgb(37 99 235 / .3); }
.btn-primario:hover:not(:disabled) { background: var(--accento-forte); }
:root[data-theme="dark"] .btn-primario { background: #2563eb; }
:root[data-theme="dark"] .btn-primario:hover:not(:disabled) { background: #1d4ed8; }
.btn-secondario { background: var(--superficie); border-color: var(--bordo-forte); color: var(--testo); }
.btn-secondario:hover:not(:disabled) { background: var(--superficie-2); }
.btn-ghost { background: transparent; color: var(--testo-2); }
.btn-ghost:hover:not(:disabled) { background: var(--superficie-2); color: var(--testo); }
.btn-pericolo { background: var(--errore-tenue); color: var(--errore); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-spinner { display: none; width: 14px; height: 14px; }
.btn.caricamento .btn-spinner { display: inline-block; }
.btn.caricamento .btn-testo { opacity: .7; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--bordo);
  background: var(--superficie); color: var(--testo-2); cursor: pointer; display: grid; place-items: center;
  position: relative; transition: background var(--tempo), color var(--tempo), transform var(--tempo);
}
.icon-btn:hover { background: var(--superficie-2); color: var(--testo); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 18px; height: 18px; }
.topbar-azioni { display: flex; gap: 8px; flex: none; margin-left: auto; }
.badge-jobs {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--accento); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; animation: pop var(--tempo) var(--curva);
}
.anello-jobs {
  position: absolute; inset: -3px; border-radius: 15px; border: 2px solid transparent;
  border-top-color: var(--accento); border-right-color: var(--accento);
  animation: ruota 1s linear infinite;
}
.icona-luna { display: none; }
:root[data-theme="dark"] .icona-luna { display: block; }
:root[data-theme="dark"] .icona-sole { display: none; }

/* ---------- filtri ---------- */
.filtri {
  min-height: var(--filtri-h);
  background: var(--superficie);
  border-bottom: 1px solid var(--bordo);
  position: relative; z-index: 30;
}
/* Niente overflow qui: con overflow-x:auto il browser forza anche overflow-y
   e i menu a tendina (position:absolute) restavano tagliati dentro i 56px
   della barra. I chip vanno a capo se non ci stanno. */
.filtri-scroll {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 18px;
}

.segmento {
  display: inline-flex; padding: 3px; border-radius: 999px; background: var(--superficie-2);
  border: 1px solid var(--bordo); flex: none;
}
.segmento button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px;
  font-weight: 600; font-size: 13px; color: var(--testo-2); cursor: pointer;
  transition: background var(--tempo), color var(--tempo), box-shadow var(--tempo);
}
.segmento button.attivo { background: var(--superficie); color: var(--testo); box-shadow: var(--ombra); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--bordo); background: var(--superficie);
  font-weight: 500; font-size: 13px; cursor: pointer; list-style: none; user-select: none; white-space: nowrap;
  transition: border-color var(--tempo), background var(--tempo), color var(--tempo), box-shadow var(--tempo);
  flex: none;
}
.chip::-webkit-details-marker { display: none; }
.chip:hover { border-color: var(--bordo-forte); background: var(--superficie-2); }
.chip-icona { color: var(--muto); font-weight: 700; font-size: 12px; display: inline-flex; }
.chip-caret { color: var(--muto); transition: transform var(--tempo); }
.dropdown[open] .chip-caret { transform: rotate(180deg); }
.dropdown.attivo .chip, .dropdown[open] .chip { border-color: var(--accento); background: var(--accento-tenue); color: var(--accento-forte); }
.dropdown.attivo .chip-icona, .dropdown[open] .chip-icona, .dropdown.attivo .chip-caret { color: var(--accento-forte); }
:root[data-theme="dark"] .dropdown.attivo .chip, :root[data-theme="dark"] .dropdown[open] .chip { color: #fff; }
.chip-reset { color: var(--errore); border-color: transparent; background: var(--errore-tenue); }
.chip-reset svg { width: 14px; height: 14px; }

.dropdown { position: relative; flex: none; }
.dropdown-corpo {
  position: absolute; top: calc(100% + 8px); left: 0; z-index: 50;
  min-width: 260px; padding: 14px; border-radius: var(--raggio);
  background: var(--superficie); border: 1px solid var(--bordo); box-shadow: var(--ombra-forte);
  display: flex; flex-direction: column; gap: 10px;
  animation: apparire var(--tempo) var(--curva);
}
.dropdown-largo { min-width: 320px; }
.campo-coppia { display: flex; gap: 10px; }
.campo-coppia label, .campo-inline { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--testo-2); font-weight: 500; flex: 1; }
.campo-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.campo-inline input, .campo-inline select { width: 110px; }
input[type="number"], input[type="search"], input[type="text"], select {
  padding: 8px 10px; border-radius: var(--raggio-sm); border: 1px solid var(--bordo);
  background: var(--superficie-2); outline: none; width: 100%;
  transition: border-color var(--tempo), box-shadow var(--tempo);
}
input:focus, select:focus { border-color: var(--accento); box-shadow: 0 0 0 3px var(--accento-tenue); }
.chip-rapidi { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-rapidi button {
  border: 1px solid var(--bordo); background: var(--superficie-2); border-radius: 999px;
  padding: 4px 10px; font-size: 12px; cursor: pointer; font-weight: 500;
}
.chip-rapidi button:hover { border-color: var(--accento); color: var(--accento); }
.chip-rapidi button.attivo { border-color: var(--accento); background: var(--accento-tenue); color: var(--accento-forte); }
.gruppo-piano { display: flex; flex-direction: column; gap: 6px; }

/* liste di zona: ricerca + caselle con conteggio */
.multi { display: flex; flex-direction: column; gap: 8px; }
.multi-lista { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.multi-voce { padding: 5px 4px; border-radius: 6px; }
.multi-voce:hover { background: var(--superficie-2); }
.multi-voce span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-voce small { color: var(--muto); font-size: 11.5px; font-variant-numeric: tabular-nums; }

/* filtri attivi, rimovibili uno a uno */
.filtri-attivi { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 9px; }
.filtro-attivo {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--accento-tenue); color: var(--accento-forte); font-size: 12px; font-weight: 600;
}
:root[data-theme="dark"] .filtro-attivo { color: #fff; }
.filtro-attivo button {
  width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
  font-size: 15px; line-height: 1; display: grid; place-items: center; padding: 0;
}
.filtro-attivo button:hover { background: rgb(0 0 0 / .12); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accento); margin: 0; }
.campo-tri { justify-content: space-between; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--bordo); }
.campo-tri select { width: 130px; }
.nota { font-size: 12px; color: var(--testo-2); margin: 0; }
.classi { display: flex; flex-direction: column; gap: 6px; }
.classi-etichetta { font-size: 12px; color: var(--testo-2); font-weight: 500; }
.classi-bottoni { display: flex; flex-wrap: wrap; gap: 4px; }
.classi-bottoni button {
  min-width: 30px; padding: 4px 7px; border-radius: 7px; border: 1px solid var(--bordo);
  background: var(--superficie-2); font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all var(--tempo);
}
.classi-bottoni button.attivo { background: var(--accento); color: #fff; border-color: var(--accento); }

.cerca {
  display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 36px; flex: 0 1 320px; min-width: 200px;
  border: 1px solid var(--bordo); border-radius: 999px; background: var(--superficie-2); color: var(--muto);
  transition: border-color var(--tempo), box-shadow var(--tempo);
}
.cerca:focus-within { border-color: var(--accento); box-shadow: 0 0 0 3px var(--accento-tenue); }
.cerca input { border: 0; background: transparent; padding: 0; box-shadow: none !important; color: var(--testo); }
.cerca input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: minmax(420px, 46%) 1fr;
  min-height: 0;
}
.lista { min-height: 0; overflow-y: auto; padding: 16px 18px 40px; scroll-behavior: smooth; }
.lista-testa { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 12px; margin-bottom: 14px; }
.lista-titolo { white-space: nowrap; margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.lista-sotto { margin: 2px 0 0; color: var(--testo-2); font-size: 12.5px; }
.lista-testa > div:first-child { min-width: 0; }
.lista-azioni { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-left: auto; }
.lista-azioni .btn svg { width: 15px; height: 15px; flex: none; }
.ordina { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--testo-2); font-weight: 500; }
.ordina select { width: auto; padding: 6px 10px; }
.cards { display: flex; flex-direction: column; gap: 10px; }

/* ---------- card ---------- */
.card {
  display: grid; grid-template-columns: 200px 1fr; gap: 0;
  background: var(--superficie); border: 1px solid var(--bordo); border-radius: var(--raggio);
  overflow: hidden; cursor: pointer; position: relative;
  box-shadow: var(--ombra);
  transition: transform var(--tempo) var(--curva), box-shadow var(--tempo), border-color var(--tempo);
  animation: salire 260ms var(--curva) both;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--ombra-forte); border-color: var(--bordo-forte); }
.card.evidenziata { border-color: var(--accento); box-shadow: 0 0 0 3px var(--accento-tenue), var(--ombra-forte); }
.card.asta.evidenziata { border-color: var(--asta); box-shadow: 0 0 0 3px var(--asta-tenue), var(--ombra-forte); }
.card-foto { position: relative; background: var(--superficie-2); min-height: 150px; overflow: hidden; }
.card-foto img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 400ms var(--curva), opacity 300ms; opacity: 0; }
.card-foto img.caricata { opacity: 1; }
.card:hover .card-foto img { transform: scale(1.04); }
.card-foto-vuota {
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--muto);
  background: linear-gradient(135deg, var(--superficie-2), var(--bordo));
}
.card-foto-vuota svg { width: 36px; height: 36px; opacity: .6; }
.card.asta .card-foto-vuota { background: linear-gradient(135deg, var(--asta-tenue), var(--superficie-2)); color: var(--asta); }
.card-foto-n { position: absolute; left: 8px; bottom: 8px; background: rgb(0 0 0 / .55); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 999px; backdrop-filter: blur(4px); }
.card-tipo {
  position: absolute; top: 8px; left: 8px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--accento); color: #fff;
}
.card.asta .card-tipo { background: var(--asta); color: #1f1300; }
.card.senza-foto { grid-template-columns: 34px 1fr; }
.card-striscia {
  display: flex; align-items: flex-start; justify-content: center; padding-top: 14px; color: var(--muto);
  background: var(--superficie-2); border-right: 1px solid var(--bordo);
}
.card-striscia svg { width: 17px; height: 17px; opacity: .75; }
.card.asta .card-striscia { background: var(--asta-tenue); color: var(--asta); border-right-color: transparent; }
.card-corpo { padding: 10px 14px 10px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.card-asta { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--testo-2); font-size: 12.5px; }
.card-asta > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.card-asta svg { color: var(--muto); }
.asta-data b { color: var(--testo); }
.asta-data.vicina b { color: var(--warn); }
.asta-data.passata b, .asta-data.nd { color: var(--muto); }
.asta-tent em { font-style: normal; color: var(--ok); font-weight: 700; }
.asta-sconto { color: var(--ok); font-weight: 600; }
.asta-sconto.sopra { color: var(--muto); font-weight: 500; }
.card-riga1-dx { display: flex; align-items: center; gap: 8px; flex: none; }
.card-riga1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-prezzo { font-size: 20px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.card-prezzo small { font-size: 12px; color: var(--testo-2); font-weight: 500; margin-left: 6px; }
.card-prezzo .barrato { text-decoration: line-through; color: var(--muto); font-weight: 500; font-size: 12.5px; margin-left: 6px; }
.card-ribasso { color: var(--ok); font-weight: 700; font-size: 12px; margin-left: 4px; }
.card-titolo { margin: 0; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-indirizzo { margin: 0; color: var(--testo-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-spec { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--testo-2); font-size: 12.5px; }
.card-spec span { display: inline-flex; align-items: center; gap: 5px; }
.card-spec svg { color: var(--muto); }
.card-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; padding-top: 4px; align-items: center; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; background: var(--superficie-2); border: 1px solid var(--bordo); color: var(--testo-2);
}
.badge svg { width: 12px; height: 12px; }
.badge-report { background: var(--report-tenue); color: var(--report); border-color: transparent; }
.badge-escluso { background: var(--errore-tenue); color: var(--errore); border-color: transparent; }
.badge-warn { background: var(--warn-tenue); color: var(--warn); border-color: transparent; }
.badge-ok { background: var(--ok-tenue); color: var(--ok); border-color: transparent; }
.badge-non-valutato { font-weight: 600; border-style: dashed; }
.badge-solo-pvp { font-weight: 600; border-style: dashed; }
.card-statico b { color: var(--testo); }
.card-motivo { margin: 2px 0 0; font-size: 12.5px; color: var(--warn); }
.badge-asta-ok { background: var(--ok-tenue); color: var(--ok); border-color: transparent; }
.badge-asta-incerta { background: var(--warn-tenue); color: var(--warn); border-color: transparent; }
.badge-asta-sotto_soglia { background: var(--superficie-2); color: var(--muto); border-color: var(--bordo); }
.badge-asta-scartata { background: var(--errore-tenue); color: var(--errore); border-color: transparent; }
.badge-portale { text-transform: capitalize; }

.anello {
  --p: 0; --colore: var(--accento);
  width: 44px; height: 44px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--colore) calc(var(--p) * 1%), var(--bordo) 0);
  display: grid; place-items: center;
  animation: riempire 700ms var(--curva);
}
.anello::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--superficie); }
.anello span { position: relative; font-size: 12px; font-weight: 800; }
.anello.basso { --colore: var(--errore); }
.anello.medio { --colore: var(--warn); }
.anello.alto { --colore: var(--ok); }
.anello.nd { --colore: var(--bordo-forte); }
.anello.nd span { color: var(--muto); font-size: 10px; }
.anello.statica { --colore: var(--muto); }
.anello.statica span { color: var(--testo-2); font-weight: 600; }
.anello.statica.avviso-giallo { --colore: var(--warn); }
.anello.statica.avviso-rosso { --colore: var(--errore); }
.anelli { display: flex; flex-direction: column; align-items: center; gap: 2px; flex: none; }
.anelli small { font-size: 9px; color: var(--muto); letter-spacing: .01em; line-height: 1.1; white-space: nowrap; }

.card-azioni { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: opacity var(--tempo), transform var(--tempo); }
.card:hover .card-azioni, .card.evidenziata .card-azioni, .card-azioni:focus-within { opacity: 1; transform: none; }
.cuore {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--bordo); background: var(--superficie);
  display: grid; place-items: center; cursor: pointer; color: var(--testo-2); box-shadow: var(--ombra);
  transition: transform var(--tempo) var(--curva), color var(--tempo), background var(--tempo);
}
.cuore:hover { transform: scale(1.1); color: var(--errore); }
.cuore.attivo { color: #fff; background: var(--errore); border-color: var(--errore); animation: pop 300ms var(--curva); }
.cuore.attivo svg { fill: currentColor; }
.cuore svg { width: 16px; height: 16px; }
.card .cuore { opacity: 1; }
.card-azioni-fisse { opacity: 1; transform: none; }
.cuore.stella:hover { color: #b7791f; }
.cuore.stella.attivo { color: #fff; background: #d69e2e; border-color: #d69e2e; }
.badge-lavoro-da_valutare { background: var(--accento-tenue); color: var(--accento); border-color: transparent; }
.badge-lavoro-offerta_fatta { background: var(--ok-tenue); color: var(--ok); border-color: transparent; }
.badge-lavoro-scartato { background: var(--superficie-2); color: var(--muto); border-color: var(--bordo); text-decoration: line-through; }
.badge-nota svg { width: 12px; height: 12px; }
.sezione-lavoro { display: flex; flex-direction: column; gap: 10px; }
.campo-lavoro { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--testo-2); }
.campo-lavoro select, .campo-lavoro textarea { font: inherit; color: var(--testo); background: var(--superficie); border: 1px solid var(--bordo); border-radius: 8px; padding: 7px 9px; }
.campo-lavoro textarea { resize: vertical; min-height: 80px; }
.lavoro-azioni { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dialogo { border: 1px solid var(--bordo); border-radius: 14px; background: var(--superficie); color: var(--testo); padding: 0; width: min(640px, calc(100vw - 32px)); box-shadow: var(--ombra); }
.dialogo::backdrop { background: rgba(0, 0, 0, .45); }
.dialogo-corpo { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; max-height: 80vh; overflow: auto; }
.dialogo-corpo h2 { margin: 0; font-size: 17px; }
.dialogo-corpo h3 { margin: 6px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--testo-2); }
.dialogo-azioni { display: flex; justify-content: flex-end; gap: 8px; }
.dp-elenco { display: flex; flex-direction: column; border: 1px solid var(--bordo); border-radius: 10px; }
.dp-riga { display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer; }
.dp-riga + .dp-riga { border-top: 1px solid var(--bordo); }
.dp-titolo { flex: 1; font-size: 13px; }
.dp-titolo small, .dp-esclusi small { display: block; font-size: 11.5px; color: var(--muto); }
.dp-costo { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-totale { margin: 0; font-size: 14px; }
.dp-avviso { margin: 0; padding: 8px 10px; border-radius: 8px; background: var(--errore-tenue); color: var(--errore); font-size: 12.5px; }
.dp-esclusi { margin: 0; padding-left: 18px; font-size: 12.5px; }
.card-cuore-fisso { position: absolute; top: 10px; right: 10px; }

/* skeleton */
.skeleton { display: grid; grid-template-columns: 200px 1fr; border-radius: var(--raggio); overflow: hidden; border: 1px solid var(--bordo); background: var(--superficie); min-height: 160px; }
.sk { background: linear-gradient(90deg, var(--superficie-2) 25%, var(--bordo) 50%, var(--superficie-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: 6px; }
.skeleton .sk-foto { border-radius: 0; height: 100%; }
.skeleton .sk-corpo { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sk-l { height: 14px; }
.sk-xl { height: 22px; width: 40%; }
.sk-m { width: 70%; }
.sk-s { width: 50%; }

.vuoto { text-align: center; padding: 60px 20px; color: var(--testo-2); animation: apparire 300ms var(--curva); }
.vuoto svg { width: 72px; height: 72px; color: var(--muto); margin-bottom: 12px; }
.vuoto h3 { margin: 0 0 6px; color: var(--testo); font-size: 16px; }
.vuoto p { margin: 0 auto; max-width: 360px; font-size: 13px; }
.vuoto .btn { margin-top: 16px; }

/* ---------- mappa ---------- */
.mappa-wrap { position: relative; background: var(--superficie-2); }
.mappa { position: absolute; inset: 0; z-index: 1; background: var(--superficie-2); }
/* Tema scuro: stesse tile OSM, invertite e desaturate via CSS (nessun secondo provider, nessuna chiave API). */
.mappa-scura .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5); }
.mappa-overlay { position: absolute; z-index: 500; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.mappa-overlay > * { pointer-events: auto; }
.mappa-overlay-top { top: 14px; left: 50%; transform: translateX(-50%); }
.mappa-overlay-bottom { left: 14px; bottom: 14px; right: 14px; justify-content: space-between; }
.btn-flottante { background: var(--superficie); color: var(--testo); box-shadow: var(--ombra-forte); border-color: var(--bordo); animation: scendere 240ms var(--curva); }
.btn-flottante:hover { background: var(--superficie-2); }
.btn-flottante-sec { padding: 8px 12px; }
.legenda { display: flex; gap: 12px; padding: 7px 12px; border-radius: 999px; background: var(--superficie); border: 1px solid var(--bordo); box-shadow: var(--ombra); font-size: 12px; color: var(--testo-2); font-weight: 500; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-vendita { background: var(--accento); }
.dot-asta { background: var(--asta); }
.dot-report { background: var(--report); }
.loader-overlay {
  position: absolute; inset: 0; z-index: 600; display: grid; place-items: center;
  background: rgb(255 255 255 / .35); backdrop-filter: blur(1px);
  opacity: 0; pointer-events: none; transition: opacity var(--tempo);
}
:root[data-theme="dark"] .loader-overlay { background: rgb(0 0 0 / .35); }
.loader-overlay.visibile { opacity: 1; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgb(127 127 127 / .3); border-top-color: currentColor; animation: ruota .8s linear infinite; display: inline-block; }
.spinner-lg { width: 36px; height: 36px; border-width: 3.5px; color: var(--accento); }
.btn-spinner { border-radius: 50%; border: 2px solid rgb(255 255 255 / .4); border-top-color: #fff; animation: ruota .8s linear infinite; }

/* marker prezzo (divIcon) */
.marker-prezzo { background: transparent; border: 0; }
.marker-prezzo .pin {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font: 700 12px/1 var(--font);
  background: var(--accento); color: #fff; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgb(0 0 0 / .3); white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: transform var(--tempo) var(--curva), background var(--tempo), box-shadow var(--tempo);
  position: relative;
}
.marker-prezzo .pin::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 8px; height: 8px;
  background: inherit; transform: translateX(-50%) rotate(45deg); border-right: 2px solid #fff; border-bottom: 2px solid #fff; border-radius: 1px;
}
.marker-prezzo .pin.asta { background: var(--asta); color: #1f1300; }
.marker-prezzo .pin .pin-report { width: 7px; height: 7px; border-radius: 50%; background: var(--report); box-shadow: 0 0 0 1.5px #fff; }
.marker-prezzo .pin.escluso { opacity: .65; }
.marker-prezzo.evidenziato .pin, .marker-prezzo:hover .pin { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 4px 16px rgb(0 0 0 / .4); z-index: 1000; }
.marker-prezzo.evidenziato .pin { background: #2563eb; color: #fff; border-color: #fff; transform: translate(-50%, -50%) scale(1.35); animation: alone 1.1s ease-out infinite; }
.cluster.cluster-evidenziato .cluster-corpo { animation: alone 1.1s ease-out infinite; transform: translate(-50%, -50%) scale(1.2); outline: 3px solid #2563eb; outline-offset: 2px; }
.marker-prezzo.evidenziato .pin.asta { background: #2563eb; color: #fff; }
.leaflet-marker-icon.marker-prezzo.evidenziato { z-index: 10000 !important; }

.cluster { background: transparent; border: 0; }
.cluster .cluster-corpo {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accento); color: #fff; font: 700 13px var(--font);
  border: 3px solid #fff; box-shadow: 0 2px 10px rgb(0 0 0 / .3);
  transform: translate(-50%, -50%);
  transition: transform var(--tempo) var(--curva);
}
.cluster:hover .cluster-corpo { transform: translate(-50%, -50%) scale(1.1); }
.cluster .cluster-corpo.misto { background: linear-gradient(135deg, var(--accento) 50%, var(--asta) 50%); }
.cluster .cluster-corpo.asta { background: var(--asta); color: #1f1300; }
.cluster .cluster-corpo.grande { width: 50px; height: 50px; font-size: 15px; }

.leaflet-popup-content-wrapper { border-radius: var(--raggio); padding: 0; overflow: hidden; background: var(--superficie); color: var(--testo); box-shadow: var(--ombra-forte); }
.leaflet-popup-content { margin: 0; width: 240px !important; }
.leaflet-popup-tip { background: var(--superficie); }
.leaflet-container a.leaflet-popup-close-button { color: #fff; top: 6px; right: 6px; background: rgb(0 0 0 / .4); border-radius: 50%; width: 22px; height: 22px; line-height: 20px; }
.popup { display: flex; flex-direction: column; }
.popup-foto { height: 120px; background: var(--superficie-2); position: relative; }
.popup-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.popup-corpo { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.popup-prezzo { font-weight: 800; font-size: 16px; }
.popup-titolo { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popup-sotto { color: var(--testo-2); font-size: 12px; }
.popup .btn { margin-top: 6px; align-self: flex-start; }
.leaflet-control-zoom a { background: var(--superficie) !important; color: var(--testo) !important; border-color: var(--bordo) !important; }
.leaflet-control-attribution { background: rgb(255 255 255 / .7) !important; font-size: 10px; }
:root[data-theme="dark"] .leaflet-control-attribution { background: rgb(0 0 0 / .6) !important; color: var(--testo-2); }
:root[data-theme="dark"] .leaflet-control-attribution a { color: var(--accento); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgb(15 23 42 / .35); z-index: 900; animation: apparire var(--tempo); backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%); z-index: 1000;
  background: var(--superficie); box-shadow: var(--ombra-forte);
  transform: translateX(104%); transition: transform 280ms var(--curva);
  display: flex; flex-direction: column;
}
.drawer.aperto { transform: none; }
.drawer-jobs { width: min(440px, 100%); }
.drawer-corpo { flex: 1; overflow-y: auto; }
.drawer-chiudi {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: rgb(0 0 0 / .45); color: #fff; cursor: pointer; display: grid; place-items: center;
  transition: background var(--tempo), transform var(--tempo);
}
.drawer-chiudi:hover { background: rgb(0 0 0 / .65); transform: rotate(90deg); }
.drawer-chiudi-inline { position: static; background: var(--superficie-2); color: var(--testo); }
.drawer-testa { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.drawer-testa h2 { margin: 0; font-size: 17px; }
.nota-occupazione { margin-top: 4px; color: var(--warn); }
.nota-jobs { padding: 0 18px 12px; border-bottom: 1px solid var(--bordo); }

/* dettaglio */
.galleria { position: relative; height: 280px; background: var(--superficie-2); overflow: hidden; }
.galleria-pista { display: flex; height: 100%; transition: transform 320ms var(--curva); }
.galleria-pista img { width: 100%; height: 100%; object-fit: cover; flex: none; }
.galleria-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .45); color: #fff; cursor: pointer; display: grid; place-items: center; transition: background var(--tempo); }
.galleria-nav:hover { background: rgb(0 0 0 / .7); }
.galleria-nav.prev { left: 10px; } .galleria-nav.next { right: 10px; }
.galleria-cont { position: absolute; left: 12px; bottom: 10px; background: rgb(0 0 0 / .55); color: #fff; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.galleria-vuota { position: relative; height: 56px; display: grid; place-items: center; color: var(--muto); background: linear-gradient(135deg, var(--superficie-2), var(--bordo)); }
.galleria-vuota.asta { background: linear-gradient(135deg, var(--asta-tenue), var(--superficie-2)); color: var(--asta); }
.galleria-vuota svg { width: 26px; height: 26px; }
.galleria-tipo { position: absolute; top: 12px; left: 12px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; background: var(--accento); color: #fff; }
.galleria-tipo.asta { background: var(--asta); color: #1f1300; }

.dettaglio { padding: 18px 20px 40px; display: flex; flex-direction: column; gap: 18px; animation: apparire 240ms var(--curva); }
.dettaglio-testa { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dettaglio-prezzo { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.dettaglio-prezzo small { font-size: 13px; color: var(--testo-2); font-weight: 500; margin-left: 8px; }
.dettaglio-titolo { margin: 4px 0 0; font-size: 16px; font-weight: 600; }
.dettaglio-indirizzo { margin: 2px 0 0; color: var(--testo-2); font-size: 13px; }
.dettaglio-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.dettaglio-azioni { display: flex; flex-wrap: wrap; gap: 8px; }
.dettaglio-azioni .btn svg { width: 15px; height: 15px; }
.sezione { border-top: 1px solid var(--bordo); padding-top: 14px; }
.sezione h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--testo-2); font-weight: 700; display: flex; align-items: center; gap: 8px; }
/* Spazio d'asta: numero chiave, fascia minima -> base (verde fino all'offerta massima dello scenario ★, rosso oltre) e
   forbice degli scenari sulla stessa scala. */
.sotto { --colore: var(--errore); }
.dentro { --colore: var(--warn); }
.sopra { --colore: var(--ok); }
.offerte-testa { margin: 0 0 10px; }
.offerte-numero { font-size: 18px; font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.offerte-numero b { color: var(--ok); font-size: 26px; font-weight: 800; }
.offerte-scenario { font-size: 13px; font-weight: 500; color: var(--testo-2); letter-spacing: 0; }
.offerte-sotto { font-size: 13px; color: var(--testo-2); margin-top: 2px; }
.offerte-righello { position: relative; margin: 4px 8px 6px; --verde: var(--ok); --rosso: var(--errore); }
.offerte-righello.bloccato { --verde: var(--muto); --rosso: var(--muto); }
.offerte-testa.bloccata .offerte-numero b { color: var(--testo); }
.offerte-estremi { position: relative; height: 34px; }
.offerte-righello.tacche-due-righe .offerte-estremi { height: 64px; }
.offerte-tacca { position: absolute; top: 0; transform: translateX(-50%); font-size: 11.5px; line-height: 1.25; text-align: center; white-space: nowrap; color: var(--testo-2); }
.offerte-tacca[data-riga="1"] { top: 30px; }
.offerte-tacca b { color: var(--testo); font-weight: 700; }
.offerte-asse { position: relative; height: 18px; }
.offerte-binario { position: absolute; left: 0; right: 0; top: 6px; height: 6px; border-radius: 3px; background: var(--bordo); }
.offerte-verde, .offerte-rosso { position: absolute; top: 2px; height: 14px; }
.offerte-verde { background: var(--verde); border-radius: 4px 0 0 4px; }
.offerte-rosso { background: var(--rosso); border-radius: 0 4px 4px 0; opacity: .8; }
.offerte-verde.intero { border-radius: 4px; }
.offerte-rosso.intero { border-radius: 4px; }
.offerte-oltre { position: absolute; top: 2px; height: 14px; border: 1px solid var(--verde); border-left: 0; border-radius: 0 4px 4px 0; box-sizing: border-box; background: repeating-linear-gradient(135deg, var(--verde) 0 3px, transparent 3px 6px); }
.offerte-marca { position: absolute; top: -2px; height: 22px; width: 0; border-left: 3px solid var(--testo); transform: translateX(-1.5px); z-index: 1; border-radius: 1px; }
.offerte-chiave { position: relative; height: 20px; }
.offerte-chiave-et { position: absolute; top: 1px; transform: translateX(-50%); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.offerte-forbice { position: relative; height: 44px; margin-top: 4px; }
.offerte-righello.due-righe .offerte-forbice { height: 66px; }
.offerte-staffa { position: absolute; top: 4px; height: 7px; border: 2px solid var(--testo-2); border-top: 0; border-radius: 0 0 3px 3px; opacity: .7; box-sizing: border-box; }
.offerte-tick { position: absolute; top: 0; height: 12px; width: 0; border-left: 2px solid var(--testo-2); transform: translateX(-1px); }
.offerte-tick.centrale { border-left: 3px solid var(--testo); transform: translateX(-1.5px); }
.offerte-etichetta { position: absolute; top: 15px; transform: translateX(-50%); font-size: 11.5px; line-height: 1.25; white-space: nowrap; color: var(--testo-2); font-weight: 600; }
.offerte-etichetta.centrale { color: var(--testo); font-weight: 800; }
.offerte-etichetta[data-riga="1"] { top: 33px; }
.offerte-etichetta.sinistra, .offerte-tacca.sinistra, .offerte-chiave-et.sinistra { transform: none; text-align: left; }
.offerte-etichetta.destra, .offerte-tacca.destra, .offerte-chiave-et.destra { transform: translateX(-100%); text-align: right; }
.offerte-badge { margin-left: auto; text-transform: none; letter-spacing: 0; color: var(--colore); background: color-mix(in srgb, var(--colore) 14%, transparent); border-color: transparent; }
.offerte-righello + .nota { margin-bottom: 4px; }
.offerte-scomposizione { margin-bottom: 6px; }
.offerte-fonte { margin-top: 4px; }
.offerte-fonte summary { cursor: pointer; }
.offerte-rischi { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 8px; }
.rischio { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; color: var(--colore); background: color-mix(in srgb, var(--colore) 14%, transparent); }
.griglia-dati { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 14px; }
.dato { display: flex; flex-direction: column; gap: 2px; }
.dato dt { font-size: 11.5px; color: var(--muto); font-weight: 500; }
.dato dd { margin: 0; font-weight: 600; font-size: 13.5px; }
.criteri { display: flex; flex-direction: column; gap: 10px; }
.criterio { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.criterio-nome { font-weight: 600; font-size: 13px; }
.criterio-valore { font-size: 12px; color: var(--testo-2); text-align: right; font-weight: 600; }
.criterio-barra { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--bordo); overflow: hidden; }
.criterio-barra i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--accento); transition: width 600ms var(--curva); }
.criterio.manca .criterio-barra i { background: var(--bordo-forte); }
.criterio-spiega { grid-column: 1 / -1; font-size: 12px; color: var(--testo-2); }
.elenco { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.avvisi { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.avviso { padding: 7px 10px; border-radius: 8px; font-size: 13px; border-left: 3px solid var(--warn); background: var(--warn-tenue); color: var(--testo); }
.avviso b { color: var(--warn); margin-right: 4px; }
.avviso.rosso { border-left-color: var(--errore); background: var(--errore-tenue); }
.avviso.rosso b { color: var(--errore); }
.elenco li.rosso { color: var(--errore); }
.elenco li.giallo { color: var(--warn); }
.pillole { display: flex; flex-wrap: wrap; gap: 6px; }
.descrizione { font-size: 13px; color: var(--testo-2); white-space: pre-line; max-height: 140px; overflow: hidden; position: relative; transition: max-height 300ms var(--curva); }
.descrizione.aperta { max-height: 4000px; }
.descrizione:not(.aperta)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 50px; background: linear-gradient(transparent, var(--superficie)); }
.link-piu { background: none; border: 0; color: var(--accento); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: 13px; }
.tabella { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabella th { text-align: left; font-size: 11.5px; color: var(--muto); font-weight: 600; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--bordo); }
.tabella td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--bordo); }
.report-box { border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--superficie-2); }
.report-box.ok { border-color: var(--report); background: var(--report-tenue); }
.report-box p { margin: 0; font-size: 13px; }
.avviso-obsoleto { border: 1px solid var(--warn); border-radius: var(--raggio); padding: 10px 14px; margin-bottom: 10px; background: var(--warn-tenue); color: var(--testo); }
.avviso-obsoleto p { margin: 0; font-size: 13px; }
.avviso-obsoleto ul { margin: 6px 0 0; font-size: 13px; }
.card.chiusa { opacity: .62; }
.giudizio { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--raggio-sm); background: var(--superficie-2); font-size: 13px; }
.giudizio b { text-transform: capitalize; }
.giudizio q { color: var(--testo-2); font-size: 12px; display: block; margin-top: 2px; }
.giudizi { display: grid; gap: 6px; }
.centrato { text-align: center; padding: 40px; color: var(--testo-2); }

/* ---------- jobs ---------- */
.jobs { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 30px; }
.job { border: 1px solid var(--bordo); border-radius: var(--raggio); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--superficie-2); animation: salire 260ms var(--curva) both; }
.job.in_corso { border-color: var(--accento); }
.job.completato { border-color: var(--ok); }
.job.errore { border-color: var(--errore); }
.job-testa { display: flex; align-items: center; gap: 10px; }
.job-stato { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.job.in_coda .job-stato { background: var(--bordo); color: var(--testo-2); }
.job.in_corso .job-stato { background: var(--accento-tenue); color: var(--accento); }
.job.completato .job-stato { background: var(--ok-tenue); color: var(--ok); }
.job.errore .job-stato { background: var(--errore-tenue); color: var(--errore); }
.job-stato svg { width: 14px; height: 14px; }
.job-url { flex: 1; min-width: 0; font-size: 12.5px; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-titolo { font-weight: 600; font-size: 13.5px; }
.job-fasi { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--testo-2); border-left: 2px solid var(--bordo); padding-left: 10px; }
.job-fasi li { animation: apparire 200ms; }
.job-fasi li:last-child { color: var(--testo); font-weight: 500; }
.job-fasi li time { color: var(--muto); margin-right: 6px; font-variant-numeric: tabular-nums; }
.job-errore { color: var(--errore); font-size: 12.5px; font-weight: 500; }
.job-azioni { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- toast ---------- */
.toasts { position: fixed; top: 76px; right: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; min-width: 260px; max-width: 380px;
  padding: 12px 14px; border-radius: var(--raggio); background: var(--superficie); border: 1px solid var(--bordo);
  box-shadow: var(--ombra-forte); animation: entrare-dx 280ms var(--curva); font-size: 13px;
}
.toast.uscita { animation: uscire-dx 220ms var(--curva) forwards; }
.toast-icona { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.toast-icona svg { width: 13px; height: 13px; }
.toast.ok .toast-icona { background: var(--ok-tenue); color: var(--ok); }
.toast.errore .toast-icona { background: var(--errore-tenue); color: var(--errore); }
.toast.info .toast-icona { background: var(--accento-tenue); color: var(--accento); }
.toast-testo { flex: 1; }
.toast-testo b { display: block; }
.toast .link-piu { padding: 0; }

/* ---------- mobile ---------- */
.mobile-switch {
  display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 800;
  background: var(--testo); color: var(--superficie); border-radius: 999px; padding: 4px; box-shadow: var(--ombra-forte);
}
.mobile-switch button { border: 0; background: transparent; color: inherit; padding: 8px 18px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.mobile-switch button.attivo { background: var(--superficie); color: var(--testo); }

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(380px, 50%) 1fr; }
  .card { grid-template-columns: 160px 1fr; }
}
@media (max-width: 600px) {
  .lista-azioni { width: 100%; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 10px; }
  body { display: block; height: auto; overflow: auto; }
  .layout { grid-template-columns: 1fr; min-height: calc(100dvh - var(--filtri-h)); }
  .lista { overflow: visible; }
  .mappa-wrap { height: calc(100dvh - var(--filtri-h) - 60px); }
  .layout[data-vista="lista"] .mappa-wrap { display: none; }
  .layout[data-vista="mappa"] .lista { display: none; }
  .mobile-switch { display: flex; }
  .card, .card.senza-foto { grid-template-columns: 1fr; }
  .card-striscia { display: none; }
  .card-foto { height: 180px; }
  .toasts { left: 12px; right: 12px; top: auto; bottom: 70px; }
  .toast { max-width: none; }
}

/* ---------- animazioni ---------- */
@keyframes alone { 0% { box-shadow: 0 0 0 0 rgb(37 99 235 / .75), 0 4px 16px rgb(0 0 0 / .4); } 100% { box-shadow: 0 0 0 16px rgb(37 99 235 / 0), 0 4px 16px rgb(0 0 0 / .4); } }
@keyframes ruota { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes apparire { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes salire { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes scendere { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes entrare-dx { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes uscire-dx { to { opacity: 0; transform: translateX(30px); } }
@keyframes riempire { from { background: conic-gradient(var(--colore) 0%, var(--bordo) 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Scheda di revisione della lettura dei lotti non residenziali */
.gruppo-lettura { margin: 8px 0; border: 1px solid var(--bordo); border-radius: 8px; padding: 6px 10px; }
.gruppo-lettura > summary { cursor: pointer; }
.voce-lettura { padding: 8px 0; border-top: 1px solid var(--bordo); font-size: 13px; }
.voce-lettura:first-of-type { border-top: 0; }
.voce-testa { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.voce-valore { color: var(--testo); }
.voce-lettura q { display: block; color: var(--testo-2); font-size: 12px; margin: 2px 0 2px 8px; }
.voce-dettaglio, .voce-scartata { margin-left: 8px; }
.voce-scartata { opacity: .85; }

/* «Come leggere i numeri» in cima al dettaglio del lotto */
.come-leggere { margin: 10px 0 4px; padding: 8px 12px; border: 1px solid var(--bordo); border-radius: var(--raggio-sm); background: var(--superficie-2); font-size: 12.5px; }
.come-leggere summary { cursor: pointer; font-weight: 700; }
.come-leggere dl { margin: 8px 0 0; display: grid; gap: 6px; }
.come-leggere dt { font-weight: 700; }
.come-leggere dd { margin: 0 0 2px; color: var(--testo-2); }
/* Riepilogo dell'aggiornamento delle aste nel pannello attività */
.job-riepilogo { margin-top: 8px; }
.job-riepilogo .job-fasi { margin-top: 4px; }
