/* Teloni Talent · area privata
   Stile: cornice in pietra chiara (sidebar) e foglio bianco per il lavoro, senza ombre.
   Colore solo sui dati: l'oro antico segna il percorso e la serata; il resto è inchiostro.
   Griglia: foglio con 32px di margine interno; colonne 2fr/1fr con 24px di spazio. */

:root {
  --frame: #f2f0eb;
  --sheet: #ffffff;
  --well: #f7f6f2;
  --ink: #161513;
  --ink-2: #3b3934;
  --muted: #625e57;
  --faint: #8b867d;
  --border: #e6e3dc;
  --rule: #efede8;
  --control: #cfcbc2;
  --accent: #7a5a12;
  --accent-soft: #efe5cc;
  --accent-wash: #f8f3e6;
  --ok: #2c6a43;
  --ok-bg: #e5efe7;
  --warn: #7f5800;
  --warn-bg: #f8eed6;
  --neg: #9e3027;
  --neg-bg: #f7e7e4;
  --info-bg: #ecebe7;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 8px;
  --r-sheet: 16px;
  --gap: 24px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--frame);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-soft); color: var(--ink); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
.num { font-variant-numeric: tabular-nums; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
html { scrollbar-color: var(--control) transparent; }

/* ───────── guscio ───────── */
.guscio { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.lato {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 22px 12px 16px; gap: 2px;
}
.marchio { display: block; padding: 4px 12px 2px; text-decoration: none; }
.marchio img { width: 116px; height: auto; }
.ambito { padding: 6px 12px 22px; font-size: 13px; color: var(--muted); line-height: 1.35; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 6px 12px; border: 0; border-radius: var(--r);
  background: none; text-decoration: none; color: var(--ink-2); font-size: 14px; cursor: pointer; text-align: left;
}
.nav a:hover, .nav button:hover { background: #e9e6df; color: var(--ink); }
.nav a[aria-current="page"] { background: #e4e0d7; color: var(--ink); font-weight: 600; }
.nav svg { width: 17px; height: 17px; flex: none; stroke: currentColor; }
.nav .conta { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 500; }
.lato-fondo { margin-top: auto; padding-top: 12px; }
.utente { display: flex; align-items: center; gap: 10px; padding: 10px 12px 0; font-size: 13px; color: var(--muted); }
.iniziale {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; flex: none;
}
.utente b { color: var(--ink); font-weight: 600; }

.foglio {
  background: var(--sheet); margin: 8px 8px 8px 0; border: 1px solid var(--border);
  border-radius: var(--r-sheet); min-height: calc(100vh - 16px); min-width: 0;
}
.pagina { padding: 28px 32px 56px; max-width: 1360px; }

.barra-mobile, .tab-mobile, .menu-mobile { display: none; }

/* ───────── titoli ───────── */
.titolo-riga { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h1 { font: 500 34px/1.1 var(--serif); letter-spacing: -0.01em; margin: 0; }
.sotto { margin: 6px 0 0; color: var(--muted); font-size: 15px; max-width: 70ch; }
.sotto strong { color: var(--ink); font-weight: 600; }
h2 { font: 600 15px/1.3 var(--sans); margin: 0 0 12px; }
h3 { font: 600 14px/1.3 var(--sans); margin: 0 0 8px; }
.serif { font-family: var(--serif); }
.indietro { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 14px; min-height: 32px; }
.indietro:hover { color: var(--ink); }
.indietro svg { width: 16px; height: 16px; }

/* ───────── controlli ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--control);
  background: var(--sheet); color: var(--ink); font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-2); }
.btn:active { transform: scale(.98); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-pieno { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-pieno:hover { background: #2d2b27; border-color: #2d2b27; }
.btn-wa { background: #1d5c3a; border-color: #1d5c3a; color: #fff; }
.btn-wa:hover { background: #164a2e; border-color: #164a2e; }
.btn-testo { border-color: transparent; background: none; padding-inline: 8px; color: var(--ink-2); }
.btn-testo:hover { background: var(--well); border-color: transparent; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-grande { min-height: 48px; padding: 12px 22px; font-size: 15px; }

.campo { display: grid; gap: 6px; }
.campo > span, .etichetta { font-size: 13px; color: var(--muted); font-weight: 500; }
input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], select, textarea {
  width: 100%; min-height: 38px; padding: 7px 12px; border: 1px solid var(--control); border-radius: var(--r);
  background: var(--sheet); font-size: 14px; transition: border-color .15s ease, background-color .15s ease;
}
select { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23625e57' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); background: #fffdf8; }
input::placeholder, textarea::placeholder { color: var(--faint); }
.cerca { position: relative; }
.cerca svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); stroke: var(--muted); pointer-events: none; }
.cerca input { padding-left: 34px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--info-bg); color: var(--ink-2);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.forse { background: var(--warn-bg); color: var(--warn); }
.pill.no { background: var(--neg-bg); color: var(--neg); }
.pill.oro { background: var(--accent-soft); color: var(--accent); }
.pill.stop { background: var(--neg-bg); color: var(--neg); }
.punto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

/* certezza del profilo */
.certezza { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.certezza i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.certezza.certo i { background: var(--ok-bg); color: var(--ok); }
.certezza.probabile i { background: var(--warn-bg); color: var(--warn); }
.certezza.nessuno i { background: var(--info-bg); color: var(--muted); }

/* ───────── pannelli ───────── */
.pannello { border: 1px solid var(--border); border-radius: 12px; padding: 20px 22px; background: var(--sheet); min-width: 0; }
.pannello-testa { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pannello-testa h2 { margin: 0; }
.pannello-testa a, .link { font-size: 13px; color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; }
.pannello-testa a:hover, .link:hover { text-decoration-color: var(--ink); }
.griglia { display: grid; gap: var(--gap); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; }
.g-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.pila { display: grid; gap: var(--gap); align-content: start; }
.vuoto { border: 1px dashed var(--control); border-radius: var(--r); padding: 12px 14px; color: var(--muted); font-size: 14px; }
.nota-esempio { background: var(--warn-bg); color: var(--warn); border-radius: var(--r); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; }

/* ───────── il percorso (elemento firma) ───────── */
.percorso { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-bottom: var(--gap); }
.tappa {
  position: relative; display: grid; align-content: start; gap: 2px; padding: 16px 16px 18px; text-decoration: none;
  border-left: 1px solid var(--border); transition: background-color .15s ease; min-width: 0;
}
.tappa:first-child { border-left: 0; }
.tappa:hover { background: var(--well); }
.tappa .nome { font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.25; min-height: 2.5em; }
.tappa .valore { font: 400 30px/1.15 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tappa .qui { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tappa .traccia { height: 6px; border-radius: 999px; background: var(--rule); margin-top: 10px; overflow: hidden; }
.tappa .traccia b { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 0; }
.tappa .freccia { position: absolute; right: -7px; top: 22px; width: 13px; height: 13px; color: var(--faint); background: var(--sheet); z-index: 1; }
.tappa:last-child .freccia { display: none; }

/* ───────── elenco «da fare» ───────── */
.dafare { list-style: none; margin: 0; padding: 0; }
.dafare li { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--rule); }
.dafare li:first-child { border-top: 0; padding-top: 2px; }
.dafare .n { font: 400 26px/1 var(--sans); font-variant-numeric: tabular-nums; text-align: right; }
.dafare .cosa { font-size: 15px; line-height: 1.35; }
.dafare .cosa small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.dafare li.urgente .n { color: var(--accent); }

/* barre orizzontali (famiglie, poli) */
.barre { display: grid; gap: 10px; }
.barra { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; text-decoration: none; padding: 2px 0; }
.barra .et { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra .v { font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.barra .v small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.barra .t { grid-column: 1 / -1; height: 4px; background: var(--rule); border-radius: 999px; overflow: hidden; }
.barra .t b { display: block; height: 100%; background: var(--ink-2); border-radius: 999px; }
.barra:hover .et { text-decoration: underline; text-underline-offset: 3px; }
.barra.primo .t b { background: var(--accent); }

#mappa { height: 300px; border-radius: var(--r); background: var(--well); z-index: 0; }
.leaflet-container { font: 13px/1.4 var(--sans) !important; }
.leaflet-tooltip.etichetta-polo { background: none; border: 0; box-shadow: none; padding: 0; font-weight: 600; font-size: 12px; color: var(--ink); }
.leaflet-tooltip.etichetta-polo::before { display: none; }

/* serata (riga evento) */
.serate { display: grid; gap: 0; }
.serata { display: grid; grid-template-columns: 54px 1fr; gap: 14px; padding: 14px 0; border-top: 1px solid var(--rule); text-decoration: none; }
.serata:first-child { border-top: 0; padding-top: 2px; }
.data-blocco { text-align: center; border-radius: var(--r); background: var(--well); padding: 6px 0 7px; align-self: start; }
.data-blocco b { display: block; font: 500 24px/1 var(--serif); }
.data-blocco span { display: block; font-size: 11px; color: var(--muted); text-transform: lowercase; margin-top: 3px; }
.data-blocco.senza b { font-size: 16px; padding: 4px 0; }
.serata .t, .serata .l, .serata .riempimento { display: block; }
.riempimento .riga, .riempimento .t { display: flex; }
.serata .t { font-weight: 600; font-size: 15px; line-height: 1.3; }
.serata .l { font-size: 13px; color: var(--muted); margin-top: 2px; }
.riempimento { margin-top: 10px; }
.riempimento .riga { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.riempimento .riga b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.riempimento .t { height: 8px; border-radius: 999px; background: var(--rule); overflow: hidden; display: flex; margin-top: 6px; }
.riempimento .t .si { background: var(--accent); }
.riempimento .t .forse { background: #d7c28f; }

/* registro */
.registro { list-style: none; margin: 0; padding: 0; }
.registro li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 9px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.registro li:first-child { border-top: 0; }
.registro .chi { color: var(--muted); font-size: 12px; grid-column: 1; }
.registro time { color: var(--muted); font-size: 12px; text-align: right; grid-row: 1; grid-column: 2; white-space: nowrap; }

/* ───────── persone ───────── */
.filtri { display: grid; grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.filtri-testa { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 14px; color: var(--muted); min-height: 32px; }
.filtri-testa b { color: var(--ink); font-variant-numeric: tabular-nums; }
.apri-filtri { display: none; }
.tabella { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabella th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 10px; white-space: nowrap; position: sticky; top: 0; background: var(--sheet); z-index: 1; }
.tabella td { padding: 10px; border-top: 1px solid var(--rule); vertical-align: middle; }
.tabella tbody tr { transition: background-color .12s ease; }
.tabella tbody tr:hover { background: var(--well); }
.tabella tbody tr.scelta { background: var(--accent-wash); }
.tabella .chk { width: 40px; padding-right: 0; }
.tabella input[type=checkbox], .scegli input { width: 18px; height: 18px; accent-color: var(--ink); cursor: pointer; }
.tabella .nome a { font-weight: 600; text-decoration: none; }
.tabella .nome a:hover { text-decoration: underline; text-underline-offset: 3px; }
.tabella .nome small { display: block; color: var(--muted); font-size: 13px; font-weight: 400; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabella .grigio { color: var(--muted); }
.tabella-box { overflow-x: auto; }
.tabella td.luogo { min-width: 170px; }
.tabella.invitati td.luogo { min-width: 0; }
.pila .dati { grid-template-columns: 96px minmax(0, 1fr); }
.dati dd { min-width: 0; overflow-wrap: anywhere; }
.tabella td.vai { width: 32px; color: var(--faint); }
.tabella td.vai svg { width: 16px; height: 16px; }
.solo-mobile { display: none !important; }
.altre { display: flex; justify-content: center; padding: 18px 0 0; }

.selezione {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 16px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--ink); color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px;
  box-shadow: 0 10px 30px rgba(22, 21, 19, .18);
}
.selezione b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.selezione select { width: auto; min-width: 180px; background-color: #2b2925; color: #fff; border-color: #4a4740; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.selezione .btn { background: transparent; color: #fff; border-color: #4a4740; }
.selezione .btn:hover { border-color: #fff; }

/* ───────── scheda persona ───────── */
.testa-persona { display: grid; grid-template-columns: 1fr auto; gap: 16px 24px; align-items: end; margin-bottom: 22px; }
.testa-persona h1 { font-size: 40px; }
.testa-persona .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 10px; font-size: 14px; color: var(--muted); }
.azioni { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.blocco + .blocco { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--rule); }
.dati { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dati dt { color: var(--muted); }
.dati dd { margin: 0; }
.aggancio { background: var(--accent-wash); border-radius: 10px; padding: 16px 18px; }
.aggancio h2 { color: var(--accent); margin-bottom: 6px; }
.aggancio p { margin: 0; font-size: 15px; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips span { background: var(--well); border-radius: 999px; padding: 3px 10px; font-size: 13px; }
.fonti { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.fonti a { word-break: break-word; }
.percorso-testo { margin: 0; white-space: pre-line; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.sintesi { font-size: 16px; line-height: 1.55; margin: 14px 0 0; max-width: 72ch; color: var(--ink); }
.motivo { font-size: 13px; color: var(--muted); margin: 10px 0 0; max-width: 80ch; }
.motivo summary { cursor: pointer; min-height: 28px; display: inline-flex; align-items: center; text-decoration: underline; text-decoration-color: var(--control); text-underline-offset: 3px; }
.motivo p { margin: 6px 0 0; }
.come-aprire { background: var(--ink); color: #fff; border-radius: 12px; padding: 14px 18px; margin: 0 0 var(--gap); }
.come-aprire .etichetta { color: #d9cfb8; }
.come-aprire p { margin: 4px 0 0; font: 400 20px/1.4 var(--serif); }
.timeline-v { list-style: none; margin: 0; padding: 0; }
.timeline-v li { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; padding: 8px 0 8px; position: relative; }
.timeline-v li + li { border-top: 1px solid var(--rule); }
.timeline-v .periodo { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.timeline-v b { display: block; font-weight: 600; font-size: 14px; }
.timeline-v span:not(.periodo) { display: block; font-size: 14px; }
.timeline-v small { display: block; color: var(--muted); font-size: 13px; }
.formazione { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.formazione small { color: var(--muted); }
.avviso-giallo { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin: 10px 0 0; line-height: 1.45; }
.avviso-giallo a { color: inherit; font-weight: 600; }
.azioni .avviso-giallo.largo { flex: 1 1 100%; margin: 0 0 4px; text-align: left; }
.attesa-si { height: auto; min-height: 38px; padding: 6px 14px; font-size: 13px; }
.avviso-profilo { margin-top: 10px !important; font-size: 13px !important; color: var(--warn); }
.check { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check label { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 7px 0; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--ok); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.check input:checked + span { color: var(--muted); }
.da-verificare { background: var(--well); border-radius: 10px; padding: 12px 14px; }
.da-verificare h3 { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.da-verificare p { margin: 0; font-size: 14px; color: var(--ink-2); }

.passi { display: grid; gap: 4px; }
.passo { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; background: none; border-radius: var(--r); cursor: pointer; text-align: left; font-size: 14px; color: var(--ink-2); }
.passo:hover { background: var(--well); }
.passo .pallino { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--control); flex: none; display: grid; place-items: center; }
.passo.fatto .pallino { background: var(--accent); border-color: var(--accent); }
.passo.attuale { background: var(--accent-wash); color: var(--ink); font-weight: 600; }
.passo.attuale .pallino { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.passi-extra { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.messaggio-box { background: var(--well); border-radius: 10px; padding: 14px; }
.messaggio-box textarea { background: var(--sheet); min-height: 150px; }
.riga-controlli { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.salvato { font-size: 13px; color: var(--ok); opacity: 0; transition: opacity .2s ease; }
.salvato.si { opacity: 1; }
.avviso-stop { background: var(--neg-bg); color: var(--neg); border-radius: 10px; padding: 12px 14px; font-size: 14px; }

/* ───────── eventi ───────── */
.eventi-lista { display: grid; gap: 0; }
.evento-riga { display: grid; grid-template-columns: 64px minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 20px; align-items: center; padding: 18px 0; border-top: 1px solid var(--rule); }
.evento-riga:first-child { border-top: 0; }
.evento-riga .data-blocco b { font-size: 28px; }
.evento-riga h2 { font: 500 22px/1.2 var(--serif); margin: 0; }
.evento-riga h2 a { text-decoration: none; }
.evento-riga h2 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.evento-riga .l { color: var(--muted); font-size: 14px; margin-top: 4px; }
.numeri { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.numeri b { display: block; font: 400 20px/1.1 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 10px 10px 9px; font-size: 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabs button span { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; margin-left: 4px; }
.programma { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.form-evento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; max-width: 920px; }
.form-evento .largo { grid-column: span 2; }
.form-evento .tutto { grid-column: 1 / -1; }

/* accoglienza: lista grande per il telefono */
.accoglienza .contatore { margin: 0; font: 400 44px/1 var(--sans); font-variant-numeric: tabular-nums; }
.accoglienza .contatore small { font-size: 18px; color: var(--muted); }
.accoglienza .cerca input { min-height: 54px; font-size: 18px; padding-left: 44px; border-radius: 12px; }
.accoglienza .cerca svg { width: 20px; height: 20px; left: 14px; }
.arrivi { list-style: none; margin: 14px 0 0; padding: 0; }
.arrivi li { border-top: 1px solid var(--rule); }
.arrivi li:first-child { border-top: 0; }
.arrivi button {
  width: 100%; display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px;
  min-height: 68px; padding: 10px 6px; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 10px;
  transition: background-color .12s ease;
}
.arrivi button:hover { background: var(--well); }
.arrivi button:active { background: var(--accent-wash); }
.arrivi .spunta { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--control); display: grid; place-items: center; transition: background-color .15s ease, border-color .15s ease; }
.arrivi .spunta svg { width: 20px; height: 20px; stroke: #fff; opacity: 0; }
.arrivi .dentro .spunta { background: var(--ok); border-color: var(--ok); }
.arrivi .dentro .spunta svg { opacity: 1; }
.arrivi .nome { font-size: 19px; font-weight: 600; line-height: 1.2; }
.arrivi .nome small { display: block; font-size: 14px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.arrivi .dentro .nome { color: var(--ok); }

/* ───────── messaggi ───────── */
.modello { padding: 20px 0; border-top: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; }
.modello:first-child { border-top: 0; padding-top: 4px; }
.modello h2 { margin: 0; font-size: 16px; }
.modello .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.modello .corpo { grid-column: 1 / -1; white-space: pre-wrap; font-size: 15px; line-height: 1.6; background: var(--well); border-radius: 10px; padding: 14px 16px; margin: 0; max-width: 75ch; }
.segnaposto { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 3px; font-weight: 500; }

/* ───────── piano ───────── */
.piano { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; }
.indice { position: sticky; top: 20px; font-size: 14px; max-height: calc(100vh - 40px); overflow: auto; }
.indice a { display: block; padding: 5px 10px; border-radius: 6px; text-decoration: none; color: var(--ink-2); line-height: 1.35; }
.indice a:hover { background: var(--well); color: var(--ink); }
.indice a.l3 { padding-left: 22px; font-size: 13px; color: var(--muted); }
.md { max-width: 74ch; font-size: 16px; line-height: 1.65; }
.md h1 { font-size: 36px; margin: 0 0 18px; }
.md h2 { font: 500 26px/1.25 var(--serif); margin: 40px 0 12px; scroll-margin-top: 20px; }
.md h3 { font: 600 16px/1.35 var(--sans); margin: 28px 0 8px; scroll-margin-top: 20px; }
.md h4 { font-size: 15px; margin: 20px 0 6px; }
.md p, .md ul, .md ol { margin: 0 0 14px; }
.md li { margin: 4px 0; }
.md blockquote { margin: 0 0 16px; padding: 12px 16px; background: var(--accent-wash); border-radius: 8px; }
.md blockquote p:last-child { margin: 0; }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 0 0 18px; display: block; overflow-x: auto; }
.md th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.md td { padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.md code { background: var(--well); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.md hr { border: 0; height: 1px; background: var(--border); margin: 28px 0; }
.md a { text-underline-offset: 3px; }
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 32px; }
.timeline a { display: block; text-decoration: none; background: var(--well); border-radius: 10px; padding: 14px 16px; transition: background-color .15s ease; }
.timeline a:hover { background: var(--accent-wash); }
.timeline .d { font: 500 20px/1.1 var(--serif); }
.timeline .t { font-size: 14px; font-weight: 600; margin-top: 6px; }
.timeline .l { font-size: 13px; color: var(--muted); }

/* ───────── assistente ───────── */
.chat { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 150px); min-height: 420px; max-width: 860px; }
.chat-log { overflow-y: auto; padding: 4px 2px 16px; display: grid; align-content: start; gap: 14px; }
.msg { max-width: 76ch; font-size: 15px; line-height: 1.6; }
.msg.tu { justify-self: end; background: var(--well); border-radius: 14px 14px 4px 14px; padding: 10px 14px; white-space: pre-wrap; }
.msg.ai .md { font-size: 15px; }
.msg.ai .md p:last-child { margin-bottom: 0; }
.msg.ai.attesa::after { content: "Sto scrivendo…"; font-size: 14px; color: var(--muted); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; border: 1px solid var(--control); border-radius: 14px; padding: 8px; background: var(--sheet); }
.composer:focus-within { border-color: var(--ink); }
.composer textarea { border: 0; min-height: 44px; max-height: 200px; resize: none; padding: 8px; background: none; }
.composer textarea:focus { background: none; }
.spunti { display: flex; flex-wrap: wrap; gap: 8px; }
.spunti button { border: 1px solid var(--border); background: var(--sheet); border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; text-align: left; }
.spunti button:hover { border-color: var(--ink-2); }

/* ───────── accesso ───────── */
.accesso { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.accesso-foto { position: relative; margin: 8px 0 8px 8px; border-radius: var(--r-sheet); overflow: hidden; background: #2b2925; }
.accesso-foto img { width: 100%; height: 100%; object-fit: cover; }
.accesso-foto figcaption { position: absolute; left: 20px; bottom: 18px; color: #fff; font-size: 13px; text-shadow: 0 1px 8px rgba(0,0,0,.5); }
.accesso-form { display: grid; place-items: center; padding: 40px 24px; }
.accesso-form form { width: 100%; max-width: 380px; display: grid; gap: 16px; }
.accesso-form img.logo { width: 150px; margin-bottom: 10px; }
.accesso-form h1 { font-size: 40px; }
.errore { color: var(--neg); font-size: 14px; min-height: 20px; margin: 0; }

/* avviso a comparsa */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 50; transition: opacity .2s ease, transform .2s ease; pointer-events: none; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.caricamento { color: var(--muted); padding: 40px 0; }
.scheletro { display: block; height: 14px; border-radius: 4px; background: var(--rule); }

dialog { border: 0; border-radius: 16px; padding: 24px; max-width: 520px; width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(22, 21, 19, .35); }

/* ───────── tablet e telefono ───────── */
@media (max-width: 1180px) {
  .g-2-1 { grid-template-columns: minmax(0, 1fr); }
  .filtri { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filtri .cerca { grid-column: 1 / -1; }
  .percorso { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tappa:nth-child(5) { border-left: 0; }
  .tappa:nth-child(n+5) { border-top: 1px solid var(--border); }
  .tappa .freccia { display: none; }
  .evento-riga { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .evento-riga .riempimento-col { grid-column: 2 / -1; }
}

@media (max-width: 860px) {
  body { background: var(--sheet); font-size: 15px; }
  .guscio { display: block; padding-bottom: 72px; }
  .lato { display: none; }
  .foglio { margin: 0; border: 0; border-radius: 0; min-height: auto; }
  .pagina { padding: 16px 16px 40px; }
  .barra-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 20; height: 52px; padding: 0 8px 0 16px; background: var(--frame);
  }
  .barra-mobile img { width: 92px; }
  .barra-mobile .ambito-m { font-size: 12px; color: var(--muted); }
  .tab-mobile {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--frame); border-top: 1px solid var(--border); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .tab-mobile a, .tab-mobile button {
    display: grid; justify-items: center; gap: 2px; padding: 6px 2px; min-height: 54px; font-size: 11px; font-weight: 500;
    color: var(--muted); text-decoration: none; border: 0; background: none; border-radius: 10px; cursor: pointer;
  }
  .tab-mobile svg { width: 22px; height: 22px; stroke: currentColor; }
  .tab-mobile [aria-current="page"] { color: var(--ink); background: #e6e2da; }
  .menu-mobile[open] { display: block; }
  .menu-mobile { position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--sheet); border-radius: 18px 18px 0 0; padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.15); }
  .menu-mobile .nav a, .menu-mobile .nav button { min-height: 50px; font-size: 16px; }
  .velo { position: fixed; inset: 0; background: rgba(22,21,19,.35); z-index: 25; }

  h1 { font-size: 30px; }
  .titolo-riga { margin-bottom: 16px; }
  .btn { min-height: 44px; }
  input[type=text], input[type=search], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=time], input[type=number], select { min-height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }
  .pannello { padding: 16px; }
  .g-1-1, .g-3 { grid-template-columns: minmax(0, 1fr); }
  :root { --gap: 16px; }

  .percorso { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tappa { border-left: 1px solid var(--border); border-top: 1px solid var(--border); padding: 12px 14px 14px; }
  .tappa:nth-child(odd) { border-left: 0; }
  .tappa:nth-child(-n+2) { border-top: 0; }
  .tappa .valore { font-size: 26px; }

  .filtri { display: none; grid-template-columns: minmax(0, 1fr); }
  .filtri.aperti { display: grid; }
  .apri-filtri { display: inline-flex; }
  .cerca-mobile { display: block; margin-bottom: 10px; }
  .tabella-box { overflow: visible; }
  .tabella td.luogo { min-width: 0; }
  .tabella thead { display: none; }
  .tabella, .tabella tbody, .tabella tr { display: block; }
  .tabella tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 2px 10px; padding: 12px 2px; border-top: 1px solid var(--rule); align-items: start; }
  .tabella td { display: block; padding: 0; border: 0; }
  .tabella td.chk { grid-row: 1 / span 3; padding-top: 2px; width: auto; }
  .tabella td.nome { grid-column: 2; }
  .tabella td.stato-c { grid-column: 3; grid-row: 1; justify-self: end; }
  .tabella td.luogo, .tabella td.fam, .tabella td.cert, .tabella td.ev { grid-column: 2 / -1; font-size: 13px; color: var(--muted); }
  .tabella td.luogo, .tabella td.fam { display: inline; }
  .tabella td.vai, .tabella td.fam { display: none; }
  .tabella:not(.invitati) td.luogo, .tabella:not(.invitati) td.cert, .tabella:not(.invitati) td.ev { display: none; }
  .tabella .nome small.solo-mobile { display: flex !important; flex-wrap: wrap; align-items: center; gap: 2px 12px; margin-top: 4px; }
  .tabella.invitati td.luogo, .tabella.invitati td.cert { display: inline-flex; margin-right: 12px; }
  .solo-mobile .certezza { font-size: 13px; }
  .solo-mobile .certezza i { width: 16px; height: 16px; font-size: 10px; }
  .tabella.invitati tr { grid-template-columns: minmax(0, 1fr) auto; }
  .tabella.invitati td.nome { grid-column: 1; }
  .tabella.invitati td.stato-c { grid-column: 2; }
  .tabella.invitati td.luogo, .tabella.invitati td.cert, .tabella.invitati td.ev { grid-column: 1 / -1; }
  .tabella .nome small { max-width: none; white-space: normal; }
  .riga-info { display: flex; flex-wrap: wrap; gap: 4px 10px; }
  .selezione { bottom: 80px; border-radius: 14px; }
  .selezione select { min-width: 0; flex: 1 1 140px; }

  .testa-persona { grid-template-columns: minmax(0, 1fr); }
  .testa-persona h1 { font-size: 32px; }
  .timeline-v li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .come-aprire p { font-size: 18px; }
  .azioni { justify-content: stretch; }
  .azioni .btn { flex: 1 1 auto; }
  .dati, .pila .dati { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .dati dd { margin-bottom: 8px; }

  .evento-riga { grid-template-columns: 56px minmax(0, 1fr); gap: 8px 14px; }
  .evento-riga > :nth-child(3), .evento-riga > :nth-child(4) { grid-column: 1 / -1; }
  .evento-riga .azioni { justify-content: flex-start; }
  .numeri { gap: 14px; flex-wrap: wrap; }
  .form-evento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form-evento .largo { grid-column: 1 / -1; }

  .piano { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .indice { position: static; max-height: none; background: var(--well); border-radius: 10px; padding: 8px; }
  .indice details summary { cursor: pointer; padding: 6px 10px; font-weight: 600; }
  .md { font-size: 16px; }
  .md h2 { font-size: 24px; }
  .timeline { grid-auto-columns: 78%; }

  .chat { display: block; height: auto; min-height: 0; }
  .chat-log { overflow: visible; padding-bottom: 12px; }
  .chat > div:last-child { position: sticky; bottom: 72px; background: var(--sheet); padding: 8px 0 10px; }
  .spunti { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .spunti button { flex: none; max-width: 78vw; }
  .modello { grid-template-columns: minmax(0, 1fr); }

  .accesso { grid-template-columns: minmax(0, 1fr); }
  .accesso-foto { margin: 0; border-radius: 0; height: 34vh; }
  .accesso-form { place-items: start center; padding: 28px 16px; }
  .accesso-form h1 { font-size: 34px; }
  .dafare li { grid-template-columns: 44px 1fr; }
  .dafare li .btn { grid-column: 2; justify-self: start; }
}

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

.come-aprire .nota-spunto{margin-top:.4rem;font-size:.82em;opacity:.75}
