/* ============================================================
   LoopUp · buco nero · spazio minimal · mobile-first iPhone
   ============================================================ */
:root {
  /* Safe-area home indicator iPhone: leggibile da JS via getComputedStyle. */
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-top: env(safe-area-inset-top, 0px);
  /* v53.12: distinzione cyan invito (CHIARO, azione pendente) vs cyan
     evento (SCURO, committed). Applicato a mappa + agenda + event-detail
     partecipi. Vedi SPEC §16.5 + §13.6.H. */
  --cyan:        #06b6d4;          /* medio neutro (legacy/inviti sub-tab) */
  --cyan-bright: #67e8f9;
  --cyan-invite: #22d3ee;          /* invito = devo decidere (bright/alert) */
  --cyan-event:  #0891b2;          /* partecipo/evento committed (dark teal) */
  --cyan-event-bright: #155e75;    /* hover/border accent dark teal */
  --cyan-dim:    rgba(6, 182, 212, 0.4);
  --cyan-soft:   rgba(6, 182, 212, 0.15);
  --cyan-event-soft: rgba(8, 145, 178, 0.15);
  --amber:       #fb923c;
  --amber-bright:#fbbf24;
  --amber-dim:   rgba(251, 146, 60, 0.4);
  --amber-soft:  rgba(251, 146, 60, 0.15);
  --green:       #22c55e;
  --green-bright:#4ade80;
  --green-dim:   rgba(34, 197, 94, 0.4);
  --green-soft:  rgba(34, 197, 94, 0.15);
  --yellow:      #fbbf24;
  --yellow-soft: rgba(251, 191, 36, 0.15);
  --danger:      #f87171;
  --danger-bright:#fca5a5;
  --danger-soft: rgba(248, 113, 113, 0.18);
  /* v53.22.15 / STEP 10: BRAND palette LoopUp.
     Applicata SOLO alle parti tecniche (nav bar, agenda, modali, sub-tabs,
     search). NON tocca canvas mappa/nebula né i color accent semantici
     degli eventi (organizzato/partecipi/pending). */
  --brand-bg:        #210040;  /* sfondi principali */
  --brand-highlight: #8C66AD;  /* highlights max 5% (CTA attive, focus) */
  --brand-dark:      #512560;  /* variante sfondi scuri / bordi */
  --brand-text:      #793F8F;  /* testi secondari (labels, placeholder) */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  /* Dynamic viewport height: su iPhone Safari si adatta quando la URL bar
     floating appare/scompare, evitando bottoni coperti. Fallback a 100% per
     browser legacy. */
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #03030a;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
body { position: fixed; inset: 0; }

#scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%; height: 100%;
  touch-action: none;
}

/* ============== UI OVERLAY ============== */
#ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  /* v9: z-index esplicito così TUTTI i figli (topbar, dropdown z=100, ecc.)
     stiano sopra elementi appesi a body direct (es. loopPageBtn z=8). */
  z-index: 10;
}
#ui > * { pointer-events: auto; }

/* ----- Topbar ----- */
#topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 14px 0;
  gap: 8px;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}
.brand {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

/* Agenda button (apre sheet) */
.agenda-btn {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 12px;
  background: var(--green-soft);
  border: 1px solid var(--green-dim);
  color: var(--green-bright);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}
.agenda-btn:hover {
  background: rgba(34, 197, 94, 0.25);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.3);
}
.agenda-btn:active { transform: scale(0.94); }
.agenda-icon { line-height: 1; }
.agenda-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--green);
  color: #001a09;
  font-size: 10px;
  font-weight: 700;
  font-family: 'SF Mono', Menlo, monospace;
  border-radius: 8px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  border: 2px solid #03030a;
}
.agenda-badge.zero { display: none; }
/* v43: badge "richieste sconosciuti in arrivo" su agenda btn — overlay viola
   in basso a destra (controparte del verde "eventi" in alto a destra). */
.agenda-stranger-badge {
  position: absolute;
  bottom: -5px; right: -5px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  font-size: 11px;
  border-radius: 8px;
  padding: 1px 5px;
  border: 2px solid #03030a;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.5);
  pointer-events: none;
  animation: agendaStrangerPulse 2.2s ease-in-out infinite;
}
.agenda-stranger-badge.hidden { display: none; }
/* v52: numero eventi DENTRO l'icona agenda (al posto dell'icona ▦) */
.agenda-count-inside {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--green-bright);
  line-height: 1;
  pointer-events: none;
  letter-spacing: -0.02em;
}
/* v53.22.11 / STEP 7: badge agenda completo (count + corners) anche in
   nebula/feed/chat — overflow visible per mostrare i corner notif. */
.agenda-btn-full {
  overflow: visible !important;
  position: relative;
}
.agenda-btn-full .agenda-count-inside {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.agenda-btn-full .agenda-corner {
  z-index: 2;
}
/* Selettori che evitano conflitto con #agendaNotifActions specifico */
.agenda-btn-full .agenda-corner-tr {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
}
.agenda-btn-full .agenda-corner-tr .anf-count {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
/* v52.1: notifiche AGLI ANGOLI del bottone agenda (top-right e bottom-right)
   — stesso pattern visivo del vecchio agenda-badge ma con tipi distinti.
   Restano DENTRO il viewport del button (overflow visible per il bordo). */
.agenda-btn { overflow: visible; }
.agenda-corner {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 5px;
  border: 2px solid #03030a;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  white-space: nowrap;
  line-height: 1;
  min-width: 18px;
}
.agenda-corner.hidden { display: none; }
.agenda-corner-tr {
  top: -6px; right: -6px;
  /* v52.7: corner azioni = verde agenda (era amber). Coerente con il colore
     dell'icona agenda (#4ade80). */
  background: linear-gradient(135deg, #4ade80, #22c55e);
  color: #042614;
  animation: agendaStrangerPulse 2.2s ease-in-out infinite;
}
.agenda-corner-br {
  bottom: -6px; right: -6px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  width: 20px; height: 20px;
  padding: 0;
  min-width: 0;
  font-size: 11px;
  animation: agendaStrangerPulse 2.4s ease-in-out infinite;
}
/* v52.6: agenda-corner-tr unificata ora come solo numero (biglietti +
   prenotazioni). Stile pallino arancione invariato. Niente emoji. */
#agendaNotifActions {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#agendaNotifActions .anf-count {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.anf-icon { font-size: 10px; line-height: 1; }
.anf-count { font-family: 'SF Mono', Menlo, monospace; font-size: 10px; line-height: 1; }

/* v44: mini badge 👽 sulla card agenda quando l'evento ha richieste pending */
.agenda-stranger-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%;
  font-size: 11px;
  margin-left: 6px;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.55);
  animation: agendaStrangerPulse 2s ease-in-out infinite;
  flex-shrink: 0;
}
/* v48: mini badge 🎫 amber per biglietto Eventbrite mancante */
.agenda-ticket-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--amber), #f97316);
  border-radius: 50%;
  font-size: 10.5px;
  margin-left: 6px;
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.55);
  animation: agendaStrangerPulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
/* v49: mini badge 🍽 cyan-tealata per prenotazione mancante (mio evento venue) */
.agenda-reservation-pending {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  border-radius: 50%;
  font-size: 10.5px;
  margin-left: 6px;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.55);
  animation: agendaStrangerPulse 2.6s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes agendaStrangerPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}
/* v43: notification dot su sub-tab 👽 (sparisce dopo primo click) */
.sub-tab-notif-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  box-shadow: 0 0 5px rgba(167, 139, 250, 0.7);
  display: inline-block;
  margin-left: 2px;
  animation: agendaStrangerPulse 2s ease-in-out infinite;
}
.sub-tab-notif-dot.hidden { display: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* + crea evento */
.create-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #f97316);
  border: none;
  color: #1a0a00;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: inherit;
  box-shadow: 0 3px 14px rgba(251, 146, 60, 0.4);
  transition: all 0.18s;
}
.create-btn:hover {
  box-shadow: 0 4px 20px rgba(251, 146, 60, 0.6);
  transform: scale(1.05);
}
.create-btn:active { transform: scale(0.94); }

/* + crea evento dentro l'agenda (giorno selezionato) */
.create-day-event-btn {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
  background: rgba(251, 146, 60, 0.10);
  border: 1px dashed rgba(251, 146, 60, 0.50);
  border-radius: 12px;
  color: var(--amber-bright);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: all 0.18s;
}
.create-day-event-btn:hover {
  background: rgba(251, 146, 60, 0.18);
  border-style: solid;
}
.create-day-event-btn:active { transform: scale(0.98); }

/* === Create event form === */
.create-event-card {
  max-height: 88vh;
  overflow-y: auto;
}
.create-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}
.create-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.create-field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  font-weight: 600;
}
.create-field-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
  margin-top: -2px;
}
.create-field input[type="text"],
.create-field input[type="date"],
.create-field input[type="time"],
.create-field textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  /* v53.11.2: textarea coerente con input — stesso bg/bord/color */
}
.create-field textarea {
  resize: vertical;
  min-height: 64px;
  line-height: 1.4;
}
.create-field input:focus,
.create-field textarea:focus {
  border-color: var(--cyan, #22d3ee);
  background: rgba(255,255,255,0.10);
}
.create-field input[type="date"],
.create-field input[type="time"] {
  color-scheme: dark;
}
.create-field-row {
  display: flex;
  gap: 10px;
}
.create-field-row .create-field { flex: 1; }

.ce-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.ce-loop-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.ce-loop-conn-count {
  margin-left: 6px;
  font-size: 10px;
  background: rgba(6, 182, 212, 0.20);
  color: #67e8f9;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 600;
}
.ce-conns-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(103, 232, 249, 0.85);
  padding-left: 14px;
  margin-bottom: 4px;
  font-weight: 600;
}
.ce-conns-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 22px;
  border-left: 2px solid rgba(6, 182, 212, 0.30);
  margin-left: 8px;
}
.ce-conn-chip { font-size: 11.5px; }

.create-quorum, .create-generic-datetime {
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.10);
}
.quorum-input {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.quorum-input input[type="number"] {
  width: 60px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: 10px;
  padding: 8px 4px;
  color: #fff;
  font-family: inherit;
}
.qu-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.qu-btn:hover { background: rgba(255,255,255,0.18); }
.quorum-hint {
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  font-style: italic;
}

.ce-tag-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.65);
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.ce-tag-chip:hover { background: rgba(255,255,255,0.10); }
.ce-tag-chip.selected {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: var(--amber-bright);
}

/* Mode switcher (3 tab) */
.mode-switcher {
  display: flex;
  gap: 3px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mode-tab {
  /* v17: position relative per badge count absolute (notifica style) */
  position: relative;
  padding: 6px 10px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}
.mode-tab:hover:not(.empty) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.mode-tab-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* v17: badge count come notifica iOS in alto-destra */
.mode-tab-count {
  position: absolute;
  top: -5px;
  right: -5px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 9px;
  padding: 0 4px;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.20);
  color: #fff;
  font-weight: 700;
  text-align: center;
  line-height: 14px;
  border: 1.5px solid rgba(3, 6, 16, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.mode-tab.empty {
  opacity: 0.35;
  pointer-events: none;
}
.mode-tab.active.tab-invite {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  box-shadow: 0 0 0 1px var(--cyan-dim) inset;
}
.mode-tab.active.tab-invite .mode-tab-count {
  background: var(--cyan); color: #001a1f; font-weight: 700;
}
.mode-tab.active.tab-propose {
  background: var(--amber-soft);
  color: var(--amber-bright);
  box-shadow: 0 0 0 1px var(--amber-dim) inset;
}
.mode-tab.active.tab-propose .mode-tab-count {
  background: var(--amber); color: #1a0a00; font-weight: 700;
}
/* v17: tab MAPPA — verde brand (coerente con agenda icon) */
.mode-tab.tab-map.active {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.45) inset;
}

/* ============ AGENDA SHEET (full-screen overlay) ============ */
.agenda-sheet {
  position: absolute;
  inset: 0;
  /* v53.22.14: sfondo agenda → viola scuro #210040 (richiesta utente). */
  background: #210040;
  z-index: 200;
  display: flex;
  flex-direction: column;
  animation: sheetIn 0.3s cubic-bezier(.2, .8, .2, 1);
}
@keyframes sheetIn {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.agenda-sheet-header {
  padding: 18px 18px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.agenda-sheet-title {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.agenda-sheet-icon {
  /* v53.22.15: icona agenda sheet → brand highlight */
  color: var(--brand-highlight);
  font-size: 22px;
}
.agenda-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.agenda-close:hover { background: rgba(255,255,255,0.18); }
.agenda-close:active { transform: scale(0.94); }

.agenda-view-toggle {
  align-self: center;
  display: flex;
  gap: 4px;
  padding: 3px;
  /* v53.22.15: pillola sub-tabs su brand-dark */
  background: var(--brand-dark);
  border-radius: 12px;
  margin: 0 auto 14px;
}
.view-tab {
  padding: 6px 16px;
  border-radius: 9px;
  background: transparent;
  border: none;
  color: var(--brand-text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}
.view-tab.active {
  /* Tab attiva = highlight brand */
  background: var(--brand-highlight);
  color: #fff;
}

.agenda-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px 24px;
  -webkit-overflow-scrolling: touch;
}

/* List view */
.agenda-day-group { margin-bottom: 22px; }
.agenda-day-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-bright);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.agenda-day-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--green-dim), transparent);
}
.agenda-event-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}
.agenda-event-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
/* v45: organizzati = amber + bordo sinistro grosso + box-shadow ambra
   per separazione visiva forte rispetto a "partecipi" (cyan tenue). */
.agenda-event-card.organized-by-me {
  background: linear-gradient(90deg,
    rgba(251, 146, 60, 0.08) 0%,
    rgba(251, 146, 60, 0.02) 60%,
    rgba(251, 146, 60, 0) 100%);
  border-color: rgba(251, 146, 60, 0.4);
  box-shadow: 0 1px 8px rgba(251, 146, 60, 0.10);
}
.agenda-event-card.organized-by-me::before {
  background: var(--amber);
  width: 4px;
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.5);
}
/* v53.12: partecipi (invito accettato, committed) → cyan SCURO #0891b2
   per distinguersi dal cyan inviti pending (chiaro/bright #22d3ee). */
.agenda-event-card.participating {
  background: rgba(8, 145, 178, 0.05);
  border-color: rgba(8, 145, 178, 0.25);
}
.agenda-event-card.participating::before {
  background: var(--cyan-event);
  width: 3px;
}

/* v26: stati PENDING dell'evento (intent=proposal, quorum non raggiunto).
   - pending-invited: invito accettato da me, in attesa che altri accettino.
     Giallo standard #facc15.
   - pending-organized: evento organizzato da me, in attesa di accept.
     Ambra carico #f59e0b. */
.agenda-event-card.agenda-pending-invited {
  background: rgba(250, 204, 21, 0.07);
  border-color: rgba(250, 204, 21, 0.40);
}
.agenda-event-card.agenda-pending-invited::before {
  background: #facc15;
  width: 4px;
}
.agenda-event-card.agenda-pending-organized {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.55);
}
.agenda-event-card.agenda-pending-organized::before {
  background: #f59e0b;
  width: 4px;
}

/* Pill "⧗ N/M" inline accanto al badge "organizzato/partecipi" */
.agenda-pending-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.45);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}
.agenda-event-card.agenda-pending-invited .agenda-pending-pill {
  color: #0a0a14;
  background: #facc15;
}
.agenda-event-card.agenda-pending-organized .agenda-pending-pill {
  color: #1a0a00;
  background: #f59e0b;
}

/* Slider/controlli +/- per modificare quorum (solo organizedByMe pending) */
.agenda-quorum-edit {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.78);
  flex-wrap: wrap;
}
.aqe-label {
  flex: 1 1 auto;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 9px;
  opacity: 0.7;
}
.aqe-btn {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, transform 0.08s;
  flex-shrink: 0;
}
.aqe-btn:hover { background: rgba(255, 255, 255, 0.18); }
.aqe-btn:active { transform: scale(0.92); }
.aqe-value {
  min-width: 22px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
}
.aqe-max {
  font-size: 9px;
  opacity: 0.55;
  text-transform: uppercase;
}

/* === v27: quorum status box (in event detail + invite long-press) === */
.event-detail-quorum,
.ei-quorum {
  margin: 10px 0 14px;
}
.event-detail-quorum.hidden,
.ei-quorum.hidden { display: none; }
.quorum-status-box {
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background 0.2s, border-color 0.2s;
}
.qs-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.qs-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.qs-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.qs-line-main {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.qs-line-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.3;
}
.qs-edit {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}
.qs-edit.hidden { display: none; }
.qs-edit-label {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.65;
  flex: 1;
  min-width: 100px;
}
/* riuso classi .aqe-btn/.aqe-value/.aqe-max già definite sopra */

/* === stato concrete (cyan) === */
.quorum-status-box.qsb-concrete {
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.3);
}
.qsb-concrete .qs-icon {
  background: rgba(6, 182, 212, 0.18);
  color: #67e8f9;
}
.qsb-concrete .qs-line-sub { color: rgba(103, 232, 249, 0.85); }

/* === stato pending-invited (giallo standard) === */
.quorum-status-box.qsb-pending-invited {
  background: rgba(250, 204, 21, 0.08);
  border-color: rgba(250, 204, 21, 0.35);
}
.qsb-pending-invited .qs-icon {
  background: rgba(250, 204, 21, 0.18);
  color: #fde68a;
}
.qsb-pending-invited .qs-line-sub { color: rgba(253, 230, 138, 0.9); }

/* === stato pending-organized (ambra carico) === */
.quorum-status-box.qsb-pending-organized {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}
.qsb-pending-organized .qs-icon {
  background: rgba(245, 158, 11, 0.22);
  color: #fcd34d;
}
.qsb-pending-organized .qs-line-sub { color: rgba(252, 211, 77, 0.9); }

/* === v28: partecipanti suddivisi per stato (event detail sheet) === */
.event-detail-participants {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.edp-group {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 12px;
}
.edp-group.hidden { display: none; }
.edp-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.edp-status-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.edp-status-dot.s-confirmed {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.35);
}
.edp-status-dot.s-pending {
  background: rgba(250, 204, 21, 0.22);
  color: #fde047;
  box-shadow: 0 0 8px rgba(250, 204, 21, 0.35);
}
.edp-status-dot.s-declined {
  background: rgba(239, 68, 68, 0.22);
  color: #f87171;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.35);
}
.edp-status-dot.s-organizer {
  background: rgba(255, 214, 107, 0.20);
  color: #FFD66B;
  box-shadow: 0 0 8px rgba(255, 214, 107, 0.32);
  font-size: 13px;
}
.edp-group-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.02em;
}
.edp-group-count {
  font-size: 11px;
  font-weight: 700;
  font-family: 'SF Mono', Menlo, monospace;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  min-width: 20px;
  text-align: center;
}
.edp-confirmed .edp-group-count { color: #4ade80; background: rgba(34, 197, 94, 0.14); }
.edp-pending .edp-group-count   { color: #fde047; background: rgba(250, 204, 21, 0.14); }
.edp-declined .edp-group-count  { color: #f87171; background: rgba(239, 68, 68, 0.14); }
.edp-group-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.edp-empty {
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  text-align: center;
  padding: 16px 0;
  font-style: italic;
}
.edp-empty.hidden { display: none; }

.agenda-event-card:hover {
  background: rgba(255,255,255,0.08);
  transform: translateY(-1px);
}
.agenda-event-card:active { transform: translateY(0); }
.agenda-event-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.agenda-event-title {
  font-size: 14.5px;
  font-weight: 600;
  color: #fff;
}
.agenda-event-time {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--cyan-bright);
  flex-shrink: 0;
}
.agenda-event-card.organized-by-me .agenda-event-time { color: var(--amber-bright); }
.agenda-event-place {
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
}
.agenda-event-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.50);
  margin-top: 4px;
}
.agenda-event-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 6px;
  font-weight: 600;
}
.agenda-event-badge.organized-by-me {
  background: var(--amber-soft);
  color: var(--amber-bright);
}
.agenda-event-badge.participating {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

.agenda-empty {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255,255,255,0.50);
  font-size: 13px;
}

/* Calendar view (compatto) */
.agenda-cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 10px;
}
.agenda-cal-month {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.agenda-cal-nav {
  background: rgba(255,255,255,0.06);
  border: none;
  color: rgba(255,255,255,0.85);
  width: 26px; height: 26px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
}
.agenda-cal-nav:hover { background: rgba(255,255,255,0.14); }
.agenda-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.agenda-cal-dayname {
  font-size: 9px;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255,255,255,0.32);
  padding: 4px 0 4px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.agenda-cal-cell {
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  cursor: default;
  transition: all 0.15s;
  position: relative;
  border: 1px solid transparent;
  font-feature-settings: "tnum" 1;
}
.agenda-cal-cell.has-events {
  cursor: pointer;
  color: #fff;
  background: rgba(255,255,255,0.04);
}
.agenda-cal-cell.has-events:hover {
  background: rgba(255,255,255,0.10);
}
.agenda-cal-cell.empty-cell { opacity: 0; pointer-events: none; }
.agenda-cal-cell.today {
  color: var(--green-bright);
  font-weight: 700;
  border-color: var(--green-dim);
}
.agenda-cal-cell.selected {
  background: var(--green-soft);
  color: #fff;
  border-color: var(--green);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}
.agenda-cal-dots {
  display: flex;
  gap: 3px;
  height: 4px;
  align-items: center;
}
.agenda-cal-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
}
.agenda-cal-dot.organized-by-me {
  background: var(--amber);
  box-shadow: 0 0 4px var(--amber);
}
.agenda-cal-dot.participating {
  background: var(--cyan);
  box-shadow: 0 0 4px var(--cyan);
}

/* Lista eventi del giorno selezionato (sotto calendario) */
.agenda-cal-day-events {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.agenda-cal-day-events-header {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-bright);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.agenda-cal-day-events-empty {
  font-size: 11.5px;
  color: rgba(255,255,255,0.40);
  text-align: center;
  padding: 18px 12px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 12px;
}
.agenda-cal-legend {
  display: flex;
  gap: 14px;
  font-size: 10px;
  color: rgba(255,255,255,0.55);
  justify-content: center;
  margin-top: 10px;
  letter-spacing: 0.02em;
}
.agenda-cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.agenda-cal-legend-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
}

/* ============ EVENT DETAIL SHEET ============ */
.event-detail-sheet {
  /* v53.13.2 / Sessione E-fix bug 1: STICKY layout — semplice e robusto.
     - Sheet position: fixed, overflow-y auto su tutto il container.
     - Header sticky-top + Actions sticky-bottom.
     - Content "block" normale che riempie lo spazio.
     Funziona indipendentemente da quanti elementi appaiono/scompaiono
     nel content (toggle sconosciuti, max invitati, accettazione auto, etc).
     Background coerente sui sticky per coprire eventuali rendering issues. */
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #050513 0%, #03030a 100%);
  z-index: 250;
  display: block;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: sheetIn 0.3s cubic-bezier(.2, .8, .2, 1);
}
.event-detail-header {
  /* v53.13.2 / Sessione E-fix bug 1: sticky top con bg coerente */
  position: sticky;
  top: 0;
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  background: linear-gradient(180deg, #050513 0%, rgba(5,5,19,0.92) 100%);
  z-index: 5;
}
.event-detail-content {
  /* Block normale, nessun overflow (lo gestisce il parent .event-detail-sheet) */
  padding: 0 22px 16px;
}
.event-detail-hero {
  text-align: center;
  margin-bottom: 22px;
}

/* Mini buco nero decorativo */
.mini-hole {
  position: relative;
  width: 100px; height: 100px;
  margin: 0 auto 18px;
}
.mini-hole-disk {
  position: absolute;
  inset: 50% 0 0 0;
  height: 100%;
  background: linear-gradient(90deg,
    var(--c1, var(--green)) 0%,
    rgba(0,0,0,0) 50%,
    var(--c1, var(--green)) 100%);
  transform: translateY(-50%) rotate(-12deg) scaleY(0.32);
  filter: blur(0.6px);
  border-radius: 50%;
  opacity: 0.6;
}
.mini-hole-core {
  position: absolute;
  inset: 16%;
  background: #000;
  border-radius: 50%;
  z-index: 2;
}
/* v53.13.1 / Sessione D-fix #3: immagine evento dentro il buco (sopra core, sotto ring) */
.mini-hole-image {
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  z-index: 2.5;
  opacity: 0.92;
}
.mini-hole-ring {
  position: absolute;
  inset: 14%;
  border: 1.5px solid var(--c1, var(--green));
  border-radius: 50%;
  box-shadow: 0 0 14px var(--c1, var(--green)),
              inset 0 0 6px var(--c1, var(--green));
  z-index: 3;
}
.event-detail-sheet.organized-by-me { --c1: #fb923c; }
/* v53.12: partecipi (invito accettato) → cyan SCURO (#0891b2) per
   distinguerlo dal cyan inviti pending (chiaro/bright). */
.event-detail-sheet.participating   { --c1: #0891b2; }

.event-detail-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}
.event-detail-when {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12.5px;
  color: var(--c1, var(--green-bright));
  margin-bottom: 4px;
}
.event-detail-where {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 12px;
}
.event-detail-organizer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.85);
}
.event-detail-organizer-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 5px;
  font-weight: 700;
}
.event-detail-sheet.organized-by-me .event-detail-organizer-badge {
  background: var(--amber-soft);
  color: var(--amber-bright);
}
.event-detail-sheet.participating .event-detail-organizer-badge {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
}

/* v53.18 / E5.5: sub-banner ex-org rientrato (era organizzatore, ha passato la gestione) */
.ex-org-sub-banner {
  margin-top: 6px;
  width: 100%;
  padding: 6px 10px;
  background: linear-gradient(90deg, rgba(251,146,60,0.14), rgba(251,146,60,0.04));
  border-left: 3px solid #fb923c;
  border-radius: 6px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.85);
  font-style: italic;
}

/* v53.18 / E5.5: badge "↺ portati da te (uscito)" per loop participating._bridgeOut */
.loop-bridge-out-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 6px;
  padding: 1px 6px;
  background: rgba(251,146,60,0.15);
  border: 1px solid rgba(251,146,60,0.35);
  color: #fdba74;
  border-radius: 999px;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
}

.event-detail-section {
  margin-bottom: 18px;
}
.event-detail-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.50);
  margin-bottom: 8px;
}
.event-detail-section-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
  margin-top: -6px;
  margin-bottom: 8px;
}
/* ============== v53.11 / Riv. B: EXTENSION CONTEXT (+1 vs loop) ============== */
.ei-extension-context {
  margin: 8px 16px 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  display: block;
}
.ei-extension-context .ei-ext-icon {
  font-size: 16px;
  margin-right: 6px;
  vertical-align: -1px;
}
.ei-extension-context .ei-ext-sub {
  display: block;
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
  font-weight: 400;
}
.ei-extension-context.ei-ext-plusone {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.10), rgba(251, 146, 60, 0.04));
  border: 1px solid rgba(251, 146, 60, 0.32);
  color: #fed7aa;
}
.ei-extension-context.ei-ext-loop {
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.10), rgba(34, 211, 238, 0.04));
  border: 1px solid rgba(34, 211, 238, 0.32);
  color: #a5f3fc;
}
.ei-extension-context b { color: #fff; font-weight: 700; }
/* ============== v53.11 / Task 6: MAX INVITEES TOGGLE + SLIDER ============== */
.create-maxinv-block {}
.ce-maxinv-slider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 14px;
  background: rgba(34, 211, 238, 0.06);
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 10px;
}
.ce-maxinv-value {
  min-width: 32px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: #22d3ee;
}
.ce-maxinv-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-left: auto;
}
/* Banner stato "max raggiunto" / "X liberi" in event detail */
.event-detail-maxinv-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 12px;
  line-height: 1.4;
}
.event-detail-maxinv-banner.maxinv-open {
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.24);
  color: rgba(186, 230, 253, 0.92);
}
.event-detail-maxinv-banner.maxinv-full {
  background: rgba(248, 113, 113, 0.10);
  border: 1px solid rgba(248, 113, 113, 0.30);
  color: rgba(254, 202, 202, 0.95);
}
/* v53.11.2: stato "nessun limite" — informativo, neutro */
.event-detail-maxinv-banner.maxinv-none {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.65);
}
.event-detail-maxinv-banner .edmi-icon { font-size: 18px; flex-shrink: 0; }
.event-detail-maxinv-banner strong { font-weight: 700; }
/* ============== v53.11 / Task 5: EVENT DESCRIPTION (messaggio organizzatore) ============== */
/* Wrappato come event-detail-section coerente con quorum/ticket/reservation. */
.event-detail-description-section .event-detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
}
.event-detail-description-section .edd-icon {
  font-size: 13px;
}
.event-detail-description-section .edd-body {
  position: relative;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.06), rgba(34, 211, 238, 0.02));
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 12px;
  padding: 14px 18px 14px 36px;
}
.edd-quote-mark {
  position: absolute;
  left: 10px;
  top: 4px;
  font-size: 38px;
  font-family: Georgia, serif;
  color: rgba(34, 211, 238, 0.45);
  line-height: 1;
}
.edd-text {
  font-size: 13.5px;
  color: rgba(255,255,255,0.88);
  line-height: 1.5;
  font-style: italic;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.edd-byline {
  font-size: 10.5px;
  color: rgba(34, 211, 238, 0.7);
  margin-top: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
/* Hint inline (parentesi opzionali) usato accanto al label */
.create-field-hint-inline {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  margin-left: 4px;
}
/* ============== v53.13 / Sessione D: STATE BANNER (event-detail) ==============
 * Banner stato lifecycle SEMPRE visibile in event-detail (eccetto past events).
 * Stati: concrete-organized / concrete-participating / pending-organized /
 *        pending-invited / concrete-failed / stranger-pending / stranger-approved
 * Ogni state ha palette + icona + animazione (pending = pulse leggero).
 */
.event-detail-state-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.event-detail-state-banner.hidden { display: none; }
.event-detail-state-banner .edsb-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.event-detail-state-banner .edsb-main {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 2px;
}
.event-detail-state-banner .edsb-sub {
  font-size: 11.5px;
  opacity: 0.85;
  line-height: 1.4;
}
.event-detail-state-banner .edsb-sub.hidden { display: none; }
/* Palette per stato */
.event-detail-state-banner.state-concrete-organized {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.12), rgba(251, 146, 60, 0.05));
  border-color: rgba(251, 146, 60, 0.35);
  color: #fed7aa;
}
.event-detail-state-banner.state-concrete-participating {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.14), rgba(8, 145, 178, 0.05));
  border-color: rgba(8, 145, 178, 0.40);
  color: #a5f3fc;
}
.event-detail-state-banner.state-pending-organized {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.05));
  border-color: rgba(245, 158, 11, 0.45);
  color: #fde68a;
  animation: stateBannerPulse 2.4s ease-in-out infinite;
}
.event-detail-state-banner.state-pending-invited {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.14), rgba(250, 204, 21, 0.05));
  border-color: rgba(250, 204, 21, 0.45);
  color: #fef3c7;
  animation: stateBannerPulse 2.4s ease-in-out infinite;
}
.event-detail-state-banner.state-concrete-failed {
  background: linear-gradient(135deg, rgba(248, 113, 113, 0.12), rgba(248, 113, 113, 0.05));
  border-color: rgba(248, 113, 113, 0.40);
  color: #fca5a5;
}
.event-detail-state-banner.state-stranger-pending {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.14), rgba(167, 139, 250, 0.05));
  border-color: rgba(250, 204, 21, 0.55);
  border-style: dashed;
  color: #ddd6fe;
  animation: stateBannerPulse 2.4s ease-in-out infinite;
}
.event-detail-state-banner.state-stranger-approved {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18), rgba(124, 58, 237, 0.08));
  border-color: rgba(124, 58, 237, 0.55);
  color: #ddd6fe;
}
@keyframes stateBannerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  50%      { box-shadow: 0 0 0 2px rgba(255,255,255,0.08); }
}

/* ============================================================
 * v53.13.2 / Sessione E-fix bug 3 · MODAL "modifiche pending al cancel"
 * ============================================================ */
.cwc-body {
  padding: 6px 4px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255,255,255,0.85);
}
.cwc-body p {
  margin: 6px 0;
}
.cwc-body strong {
  color: #fff;
  font-weight: 700;
}
.cwc-actions {
  flex-direction: column;
  gap: 8px;
}
.cwc-actions .ghost-btn,
.cwc-actions .primary-btn {
  width: 100%;
}
.primary-btn.primary-red {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.4);
}

/* ============================================================
 * v53.13.1 / Sessione E · MODAL NOMINA NUOVO ORGANIZZATORE
 * Apre da "annulla evento >3" o automatic in caso must-nominate
 * (Eventbrite/venue con biglietti/prenotazione attivi).
 * ============================================================ */
.nom-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 0;
  margin-bottom: 12px;
}
.nom-candidate {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  text-align: left;
  width: 100%;
  transition: background 0.15s, transform 0.1s;
}
.nom-candidate:active { transform: scale(0.98); }
.nom-candidate:hover { background: rgba(255,255,255,0.10); border-color: rgba(255,255,255,0.30); }
.nom-photo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.18);
  flex-shrink: 0;
}
.nom-info { flex: 1; min-width: 0; }
.nom-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}
.nom-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}
.nom-arrow {
  font-size: 18px;
  color: rgba(255,255,255,0.45);
  font-weight: 700;
}
.nom-empty {
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  padding: 22px;
  font-style: italic;
}

/* v53.13.1 / Sessione E: badge "ripreso da X" in agenda card
   (visibile se _originalOrganizer è settato dopo una nomina). */
.agenda-event-nominated {
  font-size: 11px;
  color: rgba(168, 85, 247, 0.85);
  margin: 4px 0 6px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.agenda-event-nominated b {
  color: #d8b4fe;
  font-weight: 700;
}

/* v53.13.1 / Sessione E: bottone ghost amber (per "passa la gestione" nel cancel modal) */
.ghost-btn.ghost-amber {
  border-color: rgba(251, 146, 60, 0.40);
  color: var(--amber);
}
.ghost-btn.ghost-amber:hover {
  background: rgba(251, 146, 60, 0.10);
  color: #fff;
}

/* v53.13.1 / Sessione D-fix #1: ORARIO VERDE in cima alla card agenda.
   Riga separata, ben visibile, non collide con la pill state in alto-destra. */
.agenda-event-time-top {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #4ade80; /* green-400 */
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  /* Padding-right per evitare collisione con pill state badge */
  padding-right: 110px;
}

/* === v53.13 / Sessione D: PILL STATE BADGE su agenda-event-card ===
 * Piccolo badge in alto-destra per state lifecycle. */
.agenda-event-card { position: relative; }
.agenda-state-pill {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid transparent;
}
.agenda-state-pill.state-pill-concrete-organized {
  background: rgba(251, 146, 60, 0.18);
  border-color: rgba(251, 146, 60, 0.40);
  color: #fed7aa;
}
.agenda-state-pill.state-pill-concrete-participating {
  background: rgba(8, 145, 178, 0.18);
  border-color: rgba(8, 145, 178, 0.45);
  color: #a5f3fc;
}
.agenda-state-pill.state-pill-pending-organized,
.agenda-state-pill.state-pill-pending-invited {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.50);
  color: #fde68a;
}
.agenda-state-pill.state-pill-concrete-failed {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}
.agenda-state-pill.state-pill-stranger-pending {
  background: rgba(167, 139, 250, 0.18);
  border-color: rgba(250, 204, 21, 0.55);
  color: #ddd6fe;
}
.agenda-state-pill.state-pill-stranger-approved {
  background: rgba(124, 58, 237, 0.22);
  border-color: rgba(124, 58, 237, 0.55);
  color: #ddd6fe;
}

/* ============== v53.11 / Task 4: PAST EVENT DETAIL ============== */
/* Banner past — visivo "evento concluso, sola lettura + correzioni" */
.event-detail-past-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.10), rgba(124, 58, 237, 0.06));
  border: 1px solid rgba(168, 85, 247, 0.30);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.event-detail-past-banner .edpb-icon {
  font-size: 22px;
  flex-shrink: 0;
}
.event-detail-past-banner .edpb-title {
  font-size: 13px;
  font-weight: 700;
  color: #d8b4fe;
  margin-bottom: 2px;
}
.event-detail-past-banner .edpb-sub {
  font-size: 11.5px;
  color: rgba(216, 180, 254, 0.75);
  line-height: 1.4;
}
/* Sezioni nascoste in past mode (aggiungi loop, cerca persone, invita esterni) */
.event-detail-sheet.past-event #eventDetailAvailableSection,
.event-detail-sheet.past-event #eventDetailSearchSection,
.event-detail-sheet.past-event #eventDetailExternalSection,
.event-detail-sheet.past-event #eventDetailAdd {
  display: none !important;
}
/* Chip in past mode: row container per buttons */
.ei-chip-edit-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.ei-chip-edit-btn {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.78);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
}
.ei-chip-edit-btn:active { transform: scale(0.95); }
.ei-chip-edit-absent {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.32);
}
.ei-chip-edit-absent:hover { background: rgba(248, 113, 113, 0.12); }
.ei-chip-edit-present {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.40);
  background: rgba(34, 197, 94, 0.10);
}
.ei-chip-edit-present:hover { background: rgba(34, 197, 94, 0.18); }
.ei-chip-edit-add {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.40);
  background: rgba(34, 211, 238, 0.10);
}
.ei-chip-edit-add:hover { background: rgba(34, 211, 238, 0.18); }
/* Chip past-editable: layout flex per spazio buttons a destra */
.ei-person-chip.ei-chip-past-editable {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
/* v53.11 / Riv. E: chip "vista locale assente" — l'utente partecipante ha
   marcato questa persona come non-presente, ma è solo per lui. Visivamente:
   chip greyed out con strike-through + piccola etichetta "vista privata". */
.ei-person-chip.ei-chip-locally-absent {
  opacity: 0.55;
  position: relative;
}
.ei-person-chip.ei-chip-locally-absent .ei-person-name {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}
.ei-person-chip.ei-chip-locally-absent::after {
  content: 'vista privata';
  position: absolute;
  bottom: -8px;
  right: 6px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255,255,255,0.45);
  background: rgba(0,0,0,0.45);
  padding: 1px 5px;
  border-radius: 4px;
}
/* ATLM (add-to-loop-modal) — picker compatto */
.atlm-loops {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding: 4px 0;
}
.atlm-loop-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  text-align: left;
  transition: background 0.15s, transform 0.1s;
}
.atlm-loop-btn:active { transform: scale(0.98); }
.atlm-loop-btn:hover { background: rgba(255,255,255,0.08); }
.atlm-loop-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}
.atlm-loop-info { flex: 1; min-width: 0; }
.atlm-loop-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.atlm-loop-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  margin-top: 2px;
}
.event-detail-loops-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.event-detail-available {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.available-loop-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 8px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: #fff;
  transition: all 0.15s;
}
.available-loop-chip:hover { background: rgba(255,255,255,0.10); }
.available-loop-chip:active { transform: scale(0.96); }
.available-loop-chip.selected {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-bright);
}
.available-loop-chip-photo {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid;
  object-fit: cover;
}
.loop-members-mini {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
  margin-left: 2px;
}

/* === Search persona === */
.search-wrap {
  position: relative;
}
#personSearch {
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
  outline: none;
  min-height: 44px;
  transition: border-color 0.15s;
}
#personSearch::placeholder { color: rgba(255,255,255,0.40); }
#personSearch:focus {
  border-color: var(--cyan);
  background: rgba(255,255,255,0.10);
}
.person-results {
  margin-top: 6px;
  background: rgba(20,20,40,0.95);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 12px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.2s;
}
.person-results.has-results { max-height: 320px; overflow-y: auto; }
.person-result-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  min-height: 52px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.person-result-item:last-child { border-bottom: none; }
.person-result-item:hover { background: rgba(255,255,255,0.06); }
.person-result-item:active { background: rgba(255,255,255,0.10); }
.person-result-photo {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--cyan-dim);
  object-fit: cover;
  flex-shrink: 0;
}
.person-result-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.person-result-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.person-result-handle {
  font-size: 11.5px;
  color: var(--cyan-bright);
  font-family: 'SF Mono', Menlo, monospace;
}
.person-result-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 999px;
  font-family: -apple-system, system-ui, sans-serif;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1;
}
.person-result-badge.in-circle {
  color: var(--cyan-bright);
  border-color: rgba(34,211,238,0.45);
  background: rgba(34,211,238,0.08);
}
.person-result-badge.out-circle {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.04);
}
.person-result-add {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  border: 1px solid var(--cyan-dim);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  line-height: 1;
}
.person-result-item.added .person-result-add {
  background: var(--green);
  color: #001a09;
  border-color: var(--green);
}

.selected-persons-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.selected-person-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 5px 5px 8px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--cyan);
  background: var(--cyan-soft);
  font-size: 12px;
  color: var(--cyan-bright);
  font-weight: 500;
}
.selected-person-photo {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.selected-person-x {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: none;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  line-height: 1;
}

/* === Invita external (link/QR) === */
.invite-external-row {
  display: flex;
  gap: 8px;
}
.invite-ext-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  min-height: 44px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.invite-ext-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: var(--cyan-dim);
}
.invite-ext-btn:active { transform: scale(0.97); }
.ie-btn-icon {
  font-size: 16px;
  color: var(--cyan-bright);
}

/* === QR modal === */
.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  margin: 14px 0;
}
.qr-image {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.qr-link {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: var(--cyan-bright);
  text-align: center;
  word-break: break-all;
  padding: 6px 10px;
  background: rgba(6, 182, 212, 0.10);
  border-radius: 8px;
  border: 1px dashed var(--cyan-dim);
}
.qr-hint {
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
  text-align: center;
  line-height: 1.5;
  padding: 0 8px;
}

.event-detail-actions {
  /* v53.13.2 / Sessione E-fix bug 1: sticky-bottom — sempre visibile */
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 14px 22px calc(env(safe-area-inset-bottom, 0px) + 22px);
  border-top: 1px solid rgba(255,255,255,0.08);
  background: #03030a;
  z-index: 5;
}
.ghost-btn.ghost-danger {
  border-color: rgba(248, 113, 113, 0.40);
  color: var(--danger);
}
.ghost-btn.ghost-danger:hover {
  background: var(--danger-soft);
  color: #fff;
}

/* Sub-tabs (open/rejected, solo in mode invite) */
.sub-tabs {
  display: flex;
  align-self: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px;
  background: rgba(255,255,255,0.04);
  border-radius: 11px;
}
body:not(.mode-invite) .sub-tabs { display: none; }
.sub-tab {
  padding: 5px 12px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.5);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 5px;
}
.sub-tab:hover:not(.empty) { color: #fff; }
.sub-tab.active {
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
}
.sub-tab.empty { opacity: 0.35; pointer-events: none; }
.sub-tab-count {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 9.5px;
  padding: 0 4px;
  background: rgba(255,255,255,0.10);
  border-radius: 6px;
}
body.sub-rejected .sub-tab-rejected { color: var(--danger); }
body.sub-rejected .sub-tab[data-sub="rejected"] {
  background: var(--danger-soft);
  color: var(--danger-bright);
}
/* v37: sub-tab eventi sconosciuti — viola brand. */
.sub-tab-stranger .sub-tab-icon { font-size: 13px; line-height: 1; }
body.sub-new .sub-tab[data-sub="new"] {
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
}

/* v45: pannello "gestione evento" (manager) — solo per eventi miei.
   Distinto visivamente dal resto: bordo amber tinto. */
.event-detail-manager {
  background: linear-gradient(135deg,
    rgba(251, 146, 60, 0.06),
    rgba(245, 158, 11, 0.03));
  border: 1px solid rgba(251, 146, 60, 0.22);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.event-detail-manager .event-detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--amber-bright);
  margin-bottom: 8px;
}
.edm-icon { font-size: 14px; opacity: 0.9; }
.event-detail-manager-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.event-detail-manager-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
  line-height: 1.4;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-top: 4px;
}
.event-detail-manager-hint.edm-warning {
  background: rgba(250, 204, 21, 0.08);
  color: #fde68a;
  border-left: 2px solid #facc15;
}
/* Toggle compatto (versione ridotta per manager) */
.stranger-toggle-compact {
  padding: 4px 2px;
}
.stranger-toggle-compact .stranger-toggle-title {
  font-size: 12.5px;
}
.stranger-toggle-compact .stranger-toggle-sub {
  font-size: 10.5px;
}

/* v48.B: sezione "🍽 prenotazione" — venue reservation-group.
   Palette cyan-tealata (diversa dall'amber dei ticket Eventbrite).
   Lato organizer: azioni "prenota / ho prenotato". Lato partecipante:
   "✓ confermata da X" o "⚠ nessuno ha prenotato". */
.event-detail-reservation {
  background: linear-gradient(135deg,
    rgba(6, 182, 212, 0.07),
    rgba(6, 182, 212, 0.03));
  border: 1px solid rgba(6, 182, 212, 0.28);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.event-detail-reservation .event-detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan-bright);
  margin-bottom: 10px;
}
.edr-icon { font-size: 16px; }
.edr-status { display: flex; flex-direction: column; gap: 12px; }
.edr-status-row { display: flex; align-items: center; gap: 12px; }
.edr-status-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.edr-status-info { flex: 1; min-width: 0; }
.edr-status-main { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.2; }
.edr-status-sub { font-size: 11.5px; color: rgba(255, 255, 255, 0.65); line-height: 1.3; margin-top: 2px; }
.edr-venue {
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(6, 182, 212, 0.15);
  color: var(--cyan-bright);
  flex-shrink: 0;
}
.edr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.edr-btn {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  flex: 1;
  min-width: 0;
  transition: all 0.15s;
}
.edr-btn:active { transform: scale(0.97); }
.edr-btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #001a1f;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(6, 182, 212, 0.35);
}
.edr-btn-primary:hover { box-shadow: 0 5px 18px rgba(6, 182, 212, 0.5); }
.edr-btn-secondary {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
  font-weight: 600;
}
.edr-btn-secondary:hover { background: rgba(34, 197, 94, 0.22); }
.event-detail-reservation.is-confirmed {
  background: linear-gradient(135deg,
    rgba(34, 197, 94, 0.06),
    rgba(34, 197, 94, 0.02));
  border-color: rgba(34, 197, 94, 0.30);
}
.is-confirmed .edr-status-icon {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
}
.event-detail-reservation.is-warning {
  background: linear-gradient(135deg,
    rgba(250, 204, 21, 0.08),
    rgba(250, 204, 21, 0.03));
  border-color: rgba(250, 204, 21, 0.32);
}
.is-warning .edr-status-icon {
  background: rgba(250, 204, 21, 0.22);
  color: #fde047;
}

/* v48.B: modal "compro per altri" — multi-select partecipanti senza biglietto */
.pfo-body {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.5;
  padding: 8px 0;
}
.pfo-body p { margin: 0 0 12px; }
.pfo-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.pfo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.15s;
}
.pfo-item:hover { background: rgba(255, 255, 255, 0.08); }
.pfo-item.selected {
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.45);
}
.pfo-item-photo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  flex-shrink: 0;
}
.pfo-item-info { flex: 1; min-width: 0; }
.pfo-item-name { font-size: 13px; font-weight: 600; color: #fff; }
.pfo-item-loop {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 1px;
}
.pfo-item-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: transparent;
  flex-shrink: 0;
  transition: all 0.15s;
}
.pfo-item.selected .pfo-item-check {
  background: linear-gradient(135deg, var(--amber), #f97316);
  border-color: transparent;
  color: #1a0a00;
}
.pfo-item.selected .pfo-item-check::before { content: '✓'; font-weight: 700; }

/* v48: sezione "🎫 il tuo biglietto" — eventbrite ticket flow.
   Palette amber per coerenza con badge Eventbrite. */
.event-detail-ticket {
  background: linear-gradient(135deg,
    rgba(251, 146, 60, 0.08),
    rgba(251, 146, 60, 0.03));
  border: 1px solid rgba(251, 146, 60, 0.30);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.event-detail-ticket .event-detail-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--amber-bright);
  margin-bottom: 10px;
}
.edt-icon { font-size: 16px; }
.edt-status {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.edt-status-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.edt-status-icon {
  font-size: 22px;
  line-height: 1;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.edt-status-info {
  flex: 1;
  min-width: 0;
}
.edt-status-main {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.edt-status-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.3;
  margin-top: 2px;
}
.edt-price {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(251, 146, 60, 0.18);
  color: var(--amber-bright);
  flex-shrink: 0;
}
.edt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.edt-btn {
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  flex: 1;
  min-width: 0;
  transition: all 0.15s;
}
.edt-btn:active { transform: scale(0.97); }
.edt-btn-primary {
  background: linear-gradient(135deg, var(--amber), #f97316);
  color: #1a0a00;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(251, 146, 60, 0.35);
}
.edt-btn-primary:hover { box-shadow: 0 5px 18px rgba(251, 146, 60, 0.5); }
.edt-btn-secondary {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
  font-weight: 600;
}
.edt-btn-secondary:hover { background: rgba(34, 197, 94, 0.22); }
.edt-btn-danger {
  background: transparent;
  color: rgba(248, 113, 113, 0.85);
  border-color: rgba(248, 113, 113, 0.35);
  font-weight: 600;
  flex: 0 0 auto;
}
.edt-btn-danger:hover { background: rgba(248, 113, 113, 0.1); }

/* v49.1: navigator "‹ prec / biglietto N di M / next ›" sotto la
   sezione biglietto, attivo solo quando si arriva dal banner agenda
   con più di 1 biglietto mancante. */
.edt-tour-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(251, 146, 60, 0.18);
}
.edt-tour-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.10);
  color: var(--amber-bright);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.15s;
}
.edt-tour-btn:hover {
  background: rgba(251, 146, 60, 0.22);
  border-color: rgba(251, 146, 60, 0.55);
}
.edt-tour-btn:active { transform: scale(0.92); }
.edt-tour-counter {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}
.edt-tour-counter strong {
  color: var(--amber-bright);
  font-weight: 700;
}

/* Stato "purchased" — colori verdi */
.event-detail-ticket.is-purchased {
  background: linear-gradient(135deg,
    rgba(34, 197, 94, 0.07),
    rgba(34, 197, 94, 0.02));
  border-color: rgba(34, 197, 94, 0.32);
}
.is-purchased .edt-status-icon {
  background: rgba(34, 197, 94, 0.22);
  color: #4ade80;
}
.is-purchased .edt-price {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

/* === v48 / v52.7: banner agenda "X biglietti mancanti" e prenotazioni.
   Entrambi VERDI (colore agenda), coerenti col corner badge. === */
.agenda-ticket-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 8px 16px 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg,
    rgba(74, 222, 128, 0.18),
    rgba(34, 197, 94, 0.10));
  border: 1px solid rgba(74, 222, 128, 0.45);
  border-radius: 12px;
  color: #86efac;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  box-shadow: 0 2px 10px rgba(74, 222, 128, 0.20);
}
.agenda-ticket-banner.hidden { display: none; }
.agenda-ticket-banner:active { transform: scale(0.985); }
.agenda-ticket-banner:hover {
  background: linear-gradient(135deg,
    rgba(74, 222, 128, 0.25),
    rgba(34, 197, 94, 0.16));
  box-shadow: 0 4px 14px rgba(74, 222, 128, 0.30);
}
.atb-icon { font-size: 16px; line-height: 1; }
.atb-text { flex: 1; text-align: left; }
.atb-chev { font-size: 16px; opacity: 0.7; }

/* v52.5/v52.7: banner "prenotazioni mancanti" eredita lo stile verde di
   .agenda-ticket-banner (entrambi sono "azioni mancanti agenda"). Non
   serve override colore: identico ai biglietti. */

/* v53.2: nello storico i banner azioni mancanti non hanno senso (gli eventi
   sono passati o falliti, nessuna azione da intraprendere). */
body.agenda-view-history #agendaTicketBanner,
body.agenda-view-history #agendaReservationBanner,
body.agenda-view-history #agendaCounterApprovalBanner {
  display: none !important;
}

/* v53.20.3 / Nebula STEP 2 — Modal scelta crea loop (TEMPORANEO/UFFICIALE) */
.modal-card-tall { min-height: 50vh; }
.clc-choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
}
.clc-choice {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.05);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  color: #fff;
  width: 100%;
  -webkit-tap-highlight-color: rgba(34,211,238,0.18);
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.clc-choice:active {
  transform: scale(0.98);
  background: rgba(34,211,238,0.12);
  border-color: rgba(34,211,238,0.4);
}
.clc-choice-icon {
  font-size: 36px;
  line-height: 1;
  width: 52px;
  text-align: center;
  color: #fcd34d;
}
.clc-choice:nth-child(2) .clc-choice-icon {
  color: #22d3ee;
}
.clc-choice-text { flex: 1; min-width: 0; }
.clc-choice-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.clc-choice-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  line-height: 1.35;
}

/* v53.20.3: input/list ufficiali condividono lo stile della cometa */
#olmNameInput, #olmSearchInput {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
  -webkit-appearance: none;
}
#olmNameInput:focus, #olmSearchInput:focus {
  outline: none;
  border-color: #22d3ee;
  background: rgba(34,211,238,0.08);
}
#olmConfirm:disabled { opacity: 0.4; cursor: not-allowed; }
#olmSearchResults { max-height: 30vh; overflow-y: auto; margin-top: 8px; }

/* v53.19 / F-overhaul — modal builder cometa */
/* v53.19.7: chip COMETA nel tray (bianco/grigio polvere stellare con bordo cyan) */
.dropped-chip-comet {
  background: rgba(229,231,235,0.18) !important;
  border: 1.5px solid rgba(229,231,235,0.55) !important;
  box-shadow: 0 0 10px rgba(229,231,235,0.32);
}
.dropped-chip-comet::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.96), rgba(200,210,220,0.88)) !important;
}
.dropped-chip-comet > span:not(.dropped-chip-plus) {
  color: #fff !important;
  font-weight: 600;
}

.cbm-name-section {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.cbm-name-section .cbm-section-label {
  display: block;
  margin-bottom: 8px;
}
.cbm-required {
  color: #f87171;
  font-weight: 700;
}
#cbmNameInput, #clmNameInput {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
  -webkit-appearance: none;
}
#cbmNameInput:focus, #clmNameInput:focus {
  outline: none;
  border-color: #22d3ee;
  background: rgba(34,211,238,0.08);
}
#cbmConfirm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#cbmNameInput::placeholder, #clmNameInput::placeholder {
  color: rgba(255,255,255,0.32);
  font-style: italic;
}
.clm-link-preview {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(34,211,238,0.08);
  border-radius: 8px;
  border-left: 3px solid #22d3ee;
}
.clm-link-preview.hidden { display: none; }
.clm-link-label {
  font-size: 10px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.clm-link-url {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
  color: #67e8f9;
  word-break: break-all;
}
.cbm-members-section, .cbm-search-section {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.cbm-section-label {
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}
.cbm-members-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 30vh;
  overflow-y: auto;
}
.cbm-member-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(229,231,235,0.07);
  border: 1px solid rgba(229,231,235,0.18);
  border-radius: 999px;
  color: #fff;
}
.cbm-member-me { background: rgba(34,211,238,0.15); border-color: rgba(34,211,238,0.4); }
.cbm-member-photo {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}
.cbm-member-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(229,231,235,0.18);
  font-size: 16px;
  color: rgba(255,255,255,0.6);
}
.cbm-member-name { flex: 1; font-size: 13px; }
.cbm-member-me-tag {
  font-size: 10px;
  padding: 2px 7px;
  background: #22d3ee;
  color: #001a1f;
  border-radius: 999px;
  font-weight: 700;
}
.cbm-member-link-tag {
  font-size: 9.5px;
  padding: 2px 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  color: rgba(255,255,255,0.7);
}
.cbm-member-x {
  background: rgba(248,113,113,0.16);
  border: 1px solid rgba(248,113,113,0.4);
  color: #fca5a5;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.cbm-member-x:active { transform: scale(0.97); }
.cbm-link-row { margin-top: 10px; }
.cbm-link-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  padding: 9px 14px;
  background: rgba(255,255,255,0.04);
  border: 1.5px dashed rgba(255,255,255,0.18);
  border-radius: 10px;
  color: rgba(255,255,255,0.75);
  font-size: 12.5px;
  cursor: pointer;
}
.cbm-link-btn:active { transform: scale(0.99); }
.cbm-link-icon { font-size: 14px; }
#cbmSearchInput {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
  -webkit-appearance: none;
}
#cbmSearchInput:focus {
  outline: none;
  border-color: #22d3ee;
}
#cbmSearchResults {
  max-height: 30vh;
  overflow-y: auto;
  margin-top: 8px;
}

/* v53.18.3 / E5.3: textarea modal rifiuto counter */
#rcmMessage {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
  min-height: 70px;
  box-sizing: border-box;
  -webkit-appearance: none;
}
#rcmMessage:focus {
  outline: none;
  border-color: #22d3ee;
  background: rgba(34,211,238,0.06);
}
#rcmMessage::placeholder {
  color: rgba(255,255,255,0.32);
  font-style: italic;
}

/* === v48: modal "ticketRequiredModal" === */
.ticket-modal-icon {
  margin-right: 6px;
  filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.6));
}
.ticket-modal-body {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.5;
  padding: 10px 0;
}
.ticket-modal-body p { margin: 0 0 12px; }
.ticket-price-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(251, 146, 60, 0.15);
  border: 1px solid rgba(251, 146, 60, 0.40);
  margin: 4px 0;
}
.tpp-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
}
.tpp-value {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--amber-bright);
}
.ticket-modal-hint {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
  margin-top: 14px !important;
}

/* v42: sezione "richieste in arrivo" in eventDetailSheet — lato
   organizzatore che ha aperto agli sconosciuti. Palette viola. */
.event-detail-stranger-requests {
  background: linear-gradient(135deg,
    rgba(167, 139, 250, 0.08),
    rgba(124, 58, 237, 0.04));
  border: 1px solid rgba(167, 139, 250, 0.25);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 18px;
}
.event-detail-stranger-requests .event-detail-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #c4b5fd;
}
.esr-icon { font-size: 15px; filter: drop-shadow(0 0 4px rgba(167,139,250,0.7)); }
.esr-count-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  background: rgba(167, 139, 250, 0.22);
  color: #c4b5fd;
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 22px;
  text-align: center;
}
.event-detail-stranger-requests .event-detail-section-hint {
  color: rgba(255,255,255,0.55);
  font-size: 11.5px;
  margin: 4px 0 12px;
  line-height: 1.4;
}
.event-detail-stranger-requests-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.esr-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.esr-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.esr-card-photo {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(167, 139, 250, 0.6);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.35);
}
.esr-card-info { flex: 1; min-width: 0; }
.esr-card-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.esr-card-tag {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
}
.esr-card-meta {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 2px;
  line-height: 1.4;
}
/* v44: hint atomico chiarisce che approva/rifiuta è del gruppo, non singolo */
.esr-card-atomic-hint {
  font-size: 10px;
  color: rgba(167, 139, 250, 0.85);
  margin-top: 5px;
  font-style: italic;
  line-height: 1.35;
  padding-left: 8px;
  border-left: 2px solid rgba(167, 139, 250, 0.35);
}
.esr-card-actions {
  display: flex;
  gap: 8px;
}
.esr-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.esr-btn:active { transform: scale(0.97); }
.esr-btn-reject {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}
.esr-btn-reject:hover {
  background: rgba(248, 113, 113, 0.12);
}
.esr-btn-approve {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.35);
}
.esr-btn-approve:hover {
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5);
}
/* v53.11 / Task 3: orb del LOOP (sostituisce foto del richiedente).
   Il loop è il soggetto della richiesta. Glifo 👽 per ribadire "sconosciuto". */
.esr-card-loop-orb {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(0,0,0,0.55);
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.18);
}
.esr-card-extra-loops {
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  margin-left: 4px;
}
/* v53.11 / Task 2: hint quando openToStrangers è OFF ma ci sono richieste pendenti */
.esr-frozen-hint {
  background: rgba(251, 146, 60, 0.10);
  border: 1px solid rgba(251, 146, 60, 0.32);
  color: #fdba74;
  font-size: 11.5px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 10px;
  margin-bottom: 10px;
}

/* v41: modal "proponi al tuo gruppo" per stranger events. Palette viola
   coerente con la categoria. */
.stranger-modal-icon {
  display: inline-block;
  margin-right: 6px;
  font-size: 18px;
  filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.6));
}
#strangerProposalModal .modal-title {
  color: #c4b5fd;
}
#strangerProposalModal .modal-card {
  border: 1px solid rgba(167, 139, 250, 0.28);
  box-shadow:
    0 0 0 1px rgba(167, 139, 250, 0.18) inset,
    0 20px 60px rgba(0, 0, 0, 0.6);
}
.stranger-modal-summary {
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
  padding: 12px 14px;
  background: rgba(167, 139, 250, 0.06);
  border: 1px solid rgba(167, 139, 250, 0.15);
  border-radius: 12px;
  margin: 12px 0 6px;
}
.stranger-modal-explainer {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 2px solid rgba(167, 139, 250, 0.45);
  background: rgba(167, 139, 250, 0.04);
  border-radius: 0 8px 8px 0;
}
#strangerQuorumWrap .create-field-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  line-height: 1.4;
}

/* v37: toggle "apri a nuove conoscenze" + "accettazione automatica" nel
   modal di lancio. Style iOS-like: track + thumb scorrevole. */
.create-strangers-block {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stranger-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 8px 4px;
  border-radius: 10px;
  transition: background 0.15s;
}
.stranger-toggle:hover { background: rgba(255, 255, 255, 0.03); }
.stranger-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.stranger-toggle-track {
  flex-shrink: 0;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s;
  margin-top: 2px;
}
.stranger-toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.stranger-toggle input:checked ~ .stranger-toggle-track {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}
.stranger-toggle input:checked ~ .stranger-toggle-track .stranger-toggle-thumb {
  transform: translateX(16px);
}
.stranger-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.stranger-toggle-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.stranger-toggle-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}
.stranger-toggle-nested {
  margin-left: 16px;
  padding-left: 16px;
  border-left: 2px solid rgba(167, 139, 250, 0.25);
}
.stranger-toggle-nested.hidden { display: none; }

/* ============== HOLE CONTENT (overlay HTML dentro al buco nero) ============== */

/* Pill di paginazione loop — sotto i sub-tabs, in alto al centro */
.loop-page-btn {
  position: absolute;
  align-self: center;
  margin-top: 8px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
  /* v9: z-index basso (sotto dropdown che è a z=100 dentro #ui z=10). */
  z-index: 5;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.18s;
  letter-spacing: 0.01em;
  /* posizionato dinamicamente via JS sotto i sub-tabs */
  top: 0;
  right: auto;
  left: 50%;
  transform: translateX(-50%);
}
.loop-page-btn .lp-arrow {
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
  opacity: 0.85;
}
.loop-page-btn .lp-num {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.loop-page-btn:hover { background: rgba(255,255,255,0.16); }
.loop-page-btn:active { transform: translateX(-50%) scale(0.94); }
.loop-page-btn.hidden { display: none !important; }
/* v9: nasconde il TOP 5 pill quando un dropdown (data/città) è aperto.
   Il dropdown ha z-index 100 ma il pageBtn è figlio di body root, quindi
   senza questo CSS sporgerebbe verticalmente sopra il dropdown. */
body.dropdown-open .loop-page-btn { visibility: hidden; }

.hole-content {
  position: absolute;
  --hr: 100px; /* settato via JS = holeRadius */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* v10: gap e padding ridotti per dare più aria al testo dentro il cerchio
     (iPhone Safari renderizza SF Pro bold più largo → serve spazio). */
  gap: calc(var(--hr) * 0.03);
  padding: calc(var(--hr) * 0.05);
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
  z-index: 7;
  overflow: hidden;
}
/* default: tutti i figli sono "trasparenti" agli eventi (event va al parent) */
.hole-content * { pointer-events: none; }
/* eccezione: solo le mini-foto loop sono cliccabili (apre info loop) */
.hole-loop-mini, .hole-loops-overflow { pointer-events: auto !important; }
.hole-inviter {
  display: flex;
  align-items: center;
  gap: 7px;
  pointer-events: none;
}
.hole-inviter-avatar {
  width: calc(var(--hr) * 0.22);
  height: calc(var(--hr) * 0.22);
  min-width: 24px; min-height: 24px;
  max-width: 34px; max-height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #001a1f;
  font-weight: 700;
  font-size: max(12px, calc(var(--hr) * 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mode-pill-propose ~ .agenda { /* placeholder */ }
body.mode-propose .hole-inviter { display: none; }
.hole-inviter-text {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.1;
}
.hole-inviter-label {
  font-size: max(9px, calc(var(--hr) * 0.075));
  color: var(--cyan-bright);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  line-height: 1;
}
.hole-inviter-name {
  font-size: max(13px, calc(var(--hr) * 0.13));
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.hole-divider {
  width: 60%;
  height: 1px;
  background: rgba(255,255,255,0.10);
  flex-shrink: 0;
}
body.mode-propose .hole-divider:first-of-type { display: none; }
.hole-title {
  /* v10: font più piccolo (era 0.16) per fit su iPhone Safari (SF Pro
     bold occupa più largo del SF Compat su Mac). */
  font-size: max(13px, calc(var(--hr) * 0.135));
  font-weight: 700;
  color: #fff;
  line-height: 1.18;
  padding: 0 4px;
  /* v25: NIENTE spezza parole. Solo wrap a spazi naturali.
     "Cena giapponese" → "Cena" + "giapponese" (mai "giap-ponese"). */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
  -webkit-hyphens: none;
}
.hole-when {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: max(11px, calc(var(--hr) * 0.10));
  color: var(--cyan-bright);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
body.mode-propose .hole-when { color: var(--amber-bright); }
.hole-where {
  font-size: max(11px, calc(var(--hr) * 0.10));
  color: rgba(255,255,255,0.65);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.hole-divider-loops { margin-top: 2px; }
body.mode-propose .hole-divider-loops { display: none; }
.hole-loops-mini {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}
body.mode-propose .hole-loops-mini { display: none; }
.hole-loop-mini {
  position: relative;
  width: calc(var(--hr) * 0.24);
  height: calc(var(--hr) * 0.24);
  min-width: 24px; min-height: 24px;
  max-width: 34px; max-height: 34px;
  border-radius: 50%;
  border: 1.5px solid;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  flex-shrink: 0;
}
.hole-loop-mini img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.hole-loop-mini-dot {
  position: absolute;
  bottom: -2px; right: -2px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid #000;
}
.hole-loop-mini-dot.s-confirmed { background: var(--green); }
.hole-loop-mini-dot.s-pending { background: var(--yellow); }
.hole-loop-mini-dot.s-declined { background: var(--danger); }
.hole-loops-overflow {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  padding: 2px 5px;
  background: rgba(255,255,255,0.10);
  border-radius: 6px;
  cursor: pointer;
}
/* v10: .hole-hint rimosso dal HTML, sostituito da #cardHintTooltip
   come pillola fluttuante sopra il cerchio (vedi .card-hint-tooltip). */
.hole-hint { display: none; }

.card-hint-tooltip {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* posizionato dinamicamente da JS sopra il cerchio (cy - holeR - 28). */
  top: 0;
  background: rgba(8, 12, 22, 0.88);
  color: rgba(255, 255, 255, 0.92);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 11;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.card-hint-tooltip.show {
  opacity: 1;
}
.card-hint-tooltip.hidden {
  display: none;
}

/* === Event info sheet (long press) === */
.event-info-card {
  max-height: 90vh;
  overflow-y: auto;
  padding-top: 8px;
}
.ei-photo {
  width: calc(100% + 44px);
  margin-left: -22px;
  margin-right: -22px;
  height: 140px;
  object-fit: cover;
  display: block;
  border-radius: 12px 12px 0 0;
  margin-bottom: 14px;
}
.ei-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ei-title {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  flex: 1;
  line-height: 1.2;
}
.ei-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.ei-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  gap: 12px;
}
.ei-meta-key {
  color: rgba(255,255,255,0.50);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.ei-meta-val {
  color: #fff;
  text-align: right;
  font-weight: 500;
}
.ei-empty {
  font-size: 11.5px;
  color: rgba(255,255,255,0.40);
  font-style: italic;
}
.ei-status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.ei-status-dot.s-confirmed { background: var(--green); box-shadow: 0 0 6px var(--green); }
.ei-status-dot.s-pending { background: var(--yellow); box-shadow: 0 0 6px var(--yellow); }
.ei-status-dot.s-declined { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
/* v52.3: dot organizer (icona 👑 inline, niente background sferico) */
.ei-status-dot.s-organizer {
  background: transparent;
  box-shadow: none;
  width: auto; height: auto;
  font-size: 13px;
  line-height: 1;
}
.ei-people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ei-person-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 12px;
  color: #fff;
}
.ei-person-chip.s-declined {
  opacity: 0.55;
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.08);
}
.ei-person-chip.s-declined .ei-person-name { text-decoration: line-through; }
.ei-person-photo {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.18);
}
.ei-person-chip.s-confirmed .ei-person-photo { border-color: var(--green); }
.ei-person-chip.s-pending .ei-person-photo { border-color: var(--yellow); }
.ei-person-chip.s-declined .ei-person-photo { border-color: var(--danger); }
/* v40: chip "organizer" usato per eventi sconosciuti (organizzatore esterno). */
.ei-person-chip.s-organizer {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.45);
  position: relative;
}
.ei-person-chip.s-organizer .ei-person-photo {
  border-color: #a78bfa;
  box-shadow: 0 0 6px rgba(167, 139, 250, 0.7);
}
.ei-person-chip.s-organizer::after {
  content: '👽 organizer';
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #c4b5fd;
  margin-left: 4px;
  text-transform: uppercase;
}
/* v52.3: chip "host" = organizzatore di evento regolare (no stranger).
   Bordo + badge oro (corona) per distinguere da s-organizer (viola/alien). */
.ei-person-chip.s-host {
  background: rgba(255, 214, 107, 0.10);
  border-color: rgba(255, 214, 107, 0.42);
  position: relative;
}
.ei-person-chip.s-host .ei-person-photo {
  border-color: #FFD66B;
  box-shadow: 0 0 6px rgba(255, 214, 107, 0.6);
}
.ei-person-chip.s-host::after {
  content: '👑 organizzatore';
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #FFD66B;
  margin-left: 4px;
  text-transform: uppercase;
}
/* v43 (Fase 2.F): tutti gli "sconosciuti" hanno un mini badge 👽 in basso
   a destra della foto profilo — anche se non è l'organizer.
   Identificato via classe .ei-person-chip.s-unknown (esistente) o esplicito
   data-stranger="true". */
.ei-person-chip.s-unknown .ei-person-photo,
.ei-person-chip.s-organizer .ei-person-photo {
  position: relative;
}
.ei-person-chip.s-unknown {
  position: relative;
}
/* Mini overlay 👽 — applicato come ::before sulla chip che marca lo
   sconosciuto, posizionato in alto a sinistra della foto. */
.ei-person-chip.s-unknown::before,
.esr-card-photo::after {
  content: '👽';
  position: absolute;
  bottom: 0;
  left: 18px;
  font-size: 11px;
  background: rgba(124, 58, 237, 0.95);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #03030a;
  z-index: 2;
  line-height: 1;
}
.esr-card-photo {
  position: relative;
}
.esr-card-photo::after {
  bottom: -2px;
  left: 22px;
  width: 16px;
  height: 16px;
  font-size: 10px;
}
/* v43: overlay 👽 anche sulle chip "sconosciuti" nel tray (dropped-chip-unknown).
   La foto profilo è applicata via background CSS variable --orb-bg, quindi
   il badge va sull'avatar del chip stesso. */
.dropped-chip.dropped-chip-unknown {
  position: relative;
}
.dropped-chip.dropped-chip-unknown::before {
  content: '👽';
  position: absolute;
  bottom: -3px;
  left: -3px;
  font-size: 9px;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #03030a;
  z-index: 3;
  line-height: 1;
}
.ei-person-loop-tag {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.04);
  letter-spacing: 0.01em;
  margin-left: 4px;
  white-space: nowrap;
}
.ei-see-others-btn {
  width: 100%;
  margin-top: 12px;
  padding: 13px;
  background: rgba(255,255,255,0.06);
  border: 1px dashed rgba(255,255,255,0.20);
  border-radius: 12px;
  color: var(--cyan-bright);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.ei-see-others-btn:hover {
  background: rgba(255,255,255,0.10);
  border-color: var(--cyan);
}
.ei-others {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ei-other-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  font-size: 12px;
  color: rgba(255,255,255,0.78);
}
.ei-other-photo {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.20);
}
.ei-other-name { font-weight: 500; }

.ei-source-badge {
  display: inline-block;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.ei-source-badge.src-eventbrite {
  background: rgba(252, 70, 105, 0.15);
  color: #fc4669;
  border: 1px solid rgba(252, 70, 105, 0.4);
}
.ei-source-badge.src-system {
  background: var(--amber-soft);
  color: var(--amber-bright);
  border: 1px solid var(--amber-dim);
}
.ei-source-badge.src-user {
  background: var(--cyan-soft);
  color: var(--cyan-bright);
  border: 1px solid var(--cyan-dim);
}
/* v40: badge "👽 APERTO/SU RICHIESTA" per eventi sconosciuti */
.ei-source-badge.src-stranger {
  background: rgba(167, 139, 250, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.45);
}
.ei-description {
  font-size: 12.5px;
  color: rgba(255,255,255,0.78);
  line-height: 1.55;
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  margin-bottom: 12px;
}
.ei-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 16px;
}
.ei-tag {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.65);
  border: 1px solid rgba(255,255,255,0.10);
}
.ei-section { margin-bottom: 14px; }
.ei-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  margin-bottom: 8px;
}
.ei-related-loops, .ei-related-persons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Bottone icon-only (per ‹ ›) */
.round-btn.icon-only {
  padding: 10px 14px;
  font-size: 16px;
  font-weight: 700;
}

/* ============== Invited-by box (legacy, ora hidden) ============== */
.invited-by {
  position: absolute;
  bottom: 86px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 24px);
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 14px;
  background: linear-gradient(180deg, rgba(6, 182, 212, 0.10), rgba(6, 182, 212, 0.04));
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
body.mode-propose .invited-by { display: none; }
body.mode-agenda .invited-by {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.12), rgba(34, 197, 94, 0.04));
  border-color: rgba(34, 197, 94, 0.4);
}
body.sub-rejected .invited-by {
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.10), rgba(248, 113, 113, 0.04));
  border-color: rgba(248, 113, 113, 0.4);
}

.invited-by-card {
  display: flex;
  align-items: center;
  gap: 10px;
}
.invited-by-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #001a1f;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
body.mode-agenda .invited-by-avatar {
  background: linear-gradient(135deg, var(--green), #16a34a);
}
body.sub-rejected .invited-by-avatar {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color: #1a0000;
}
.invited-by-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.invited-by-label {
  font-size: 9.5px;
  color: var(--cyan-bright);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}
body.mode-agenda .invited-by-label { color: var(--green-bright); }
body.sub-rejected .invited-by-label { color: var(--danger-bright); }
.invited-by-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.participating-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.participating-label {
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.participating-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.participating-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255,255,255,0.04);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s, background 0.15s;
}
.participating-chip:active { transform: scale(0.97); }
.participating-chip:hover { background: rgba(255,255,255,0.10); }

.pchip-status-icon {
  font-size: 10px;
  font-weight: 700;
  width: 12px;
  text-align: center;
}
.pchip-name { letter-spacing: 0.01em; }

.participating-chip.status-confirmed {
  border-color: rgba(34, 197, 94, 0.5);
  background: rgba(34, 197, 94, 0.10);
}
.participating-chip.status-confirmed .pchip-status-icon { color: var(--green); }
.participating-chip.status-pending {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.10);
}
.participating-chip.status-pending .pchip-status-icon { color: var(--yellow); }
.participating-chip.status-declined {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  opacity: 0.55;
}
.participating-chip.status-declined .pchip-name {
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.3);
}
.participating-chip.status-declined .pchip-status-icon { color: var(--danger); }

/* ============== Dropped tray (sempre in basso, sopra ai bottoni) ============== */
.dropped-tray {
  position: absolute;
  bottom: 80px; /* appena sopra ai bottoni di azione */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100vw - 20px);
  max-width: 480px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid;
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 6;
}
body.mode-invite .dropped-tray { border-color: rgba(6, 182, 212, 0.5); }
body.mode-propose .dropped-tray { border-color: rgba(251, 146, 60, 0.5); }

.dropped-tray-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  margin-bottom: 7px;
}
body.mode-invite .dropped-tray-label { color: var(--cyan-bright); }
body.mode-agenda .dropped-tray-label { color: var(--green-bright); }
body.mode-propose .dropped-tray-label { color: var(--amber-bright); }
.dropped-tray-count {
  font-family: 'SF Mono', Menlo, monospace;
  background: rgba(255,255,255,0.10);
  padding: 2px 7px;
  border-radius: 7px;
  font-weight: 600;
}
.dropped-tray-clearall {
  margin-left: auto;
  padding: 4px 9px;
  background: rgba(248, 113, 113, 0.18);
  border: 1px solid rgba(248, 113, 113, 0.45);
  color: var(--danger);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}
.dropped-tray-clearall:hover {
  background: rgba(248, 113, 113, 0.32);
  color: #fff;
}
.dropped-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dropped-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 3px 3px 9px;
  border-radius: 999px;
  border: 1px solid;
  font-size: 11px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.4);
  animation: chipIn 0.25s ease-out;
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
.dropped-chip-x {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  border: none;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.dropped-chip-x:hover { background: rgba(255,255,255,0.22); }

/* v47: tooltip popover sopra il chip — position fixed così non viene
   clipato dall'overflow:hidden del tray. Coordinate (top, left) settate
   da JS da chip.getBoundingClientRect(). transform si occupa di centrare
   orizzontalmente e ancorare la base sopra il chip. */
.dropped-chip-tooltip {
  position: fixed;
  transform: translate(-50%, -100%) translateY(4px) scale(0.92);
  background: rgba(15, 20, 30, 0.96);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.dropped-chip-tooltip.show {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(0) scale(1);
}
/* Freccetta verso il chip sottostante — supporta offset via custom prop
   per puntare al chip anche quando il tooltip è clampato lateralmente. */
.dropped-chip-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(50% + var(--tip-arrow-offset, 0px));
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(15, 20, 30, 0.96);
}

/* v53: variante multi-riga per chip LOOP — mostra membri con status */
.dropped-chip-tooltip-loop {
  white-space: normal;
  text-align: left;
  padding: 8px 12px 9px;
  min-width: 150px;
  max-width: 230px;
}
.dropped-chip-tooltip-loop .ldt-header {
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
  letter-spacing: 0.02em;
}
.dropped-chip-tooltip-loop .ldt-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dropped-chip-tooltip-loop .ldt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  line-height: 1.4;
}
.dropped-chip-tooltip-loop .ldt-name {
  color: rgba(255, 255, 255, 0.92);
  font-weight: 500;
}
.dropped-chip-tooltip-loop .ldt-icon {
  font-size: 11px;
  line-height: 1;
}
.dropped-chip-tooltip-loop .ldt-accepted .ldt-icon { color: #4ade80; }
.dropped-chip-tooltip-loop .ldt-pending  .ldt-icon { color: #facc15; }
.dropped-chip-tooltip-loop .ldt-declined .ldt-icon { color: #f87171; }
.dropped-chip-tooltip-loop .ldt-declined .ldt-name { opacity: 0.62; text-decoration: line-through; }
.dropped-chip-tooltip-loop .ldt-sep {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin: 7px 0 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: lowercase;
  letter-spacing: 0.04em;
  text-align: center;
}
.dropped-chip-tooltip-loop .ldt-extra-row .ldt-name {
  color: rgba(255, 255, 255, 0.80);
  font-style: italic;
}

/* ============== Bottom actions ============== */
#bottomActions {
  margin-top: auto;
  /* Padding-bottom dinamico: rispetta safe-area-inset (home indicator iPhone)
     E aggiunge spazio per la barra Safari (URL bar inferiore floating).
     Su iPhone reale la barra Safari floating può sovrapporsi → senza questo
     padding, il bottone "lancia · N" finiva sotto la barra (non cliccabile). */
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 22px);
  display: flex;
  justify-content: center;
}
.actions-invite-open, .actions-invite-rejected, .actions-agenda, .actions-propose {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
/* v22: propose i 4 bottoni (< prossima · butta tutti · lancia) su UNA RIGA.
   Niente wrap, dimensioni più compatte. */
body.theme-map .actions-propose {
  flex-wrap: nowrap;
  gap: 5px;
  align-items: center;
  width: 100%;
}
body.theme-map .actions-propose .round-btn {
  padding: 8px 10px;
  font-size: 10.5px;
  flex-shrink: 1;
  min-width: 0;
  white-space: nowrap;
}
/* < indietro: icon-only, compatto */
body.theme-map .actions-propose #btnPrev {
  padding: 8px 11px;
  flex-shrink: 0;
}
/* prossima: prende lo spazio rimanente, label tronca se necessario */
body.theme-map .actions-propose #btnProssimo {
  flex: 1 1 auto;
  text-overflow: ellipsis;
  overflow: hidden;
}
/* lancia · N: bottone primary, full visibile (no shrink eccessivo) */
body.theme-map .actions-propose #btnConferma {
  flex-shrink: 0;
}
/* v24: stato inactive del bottone "lancia" quando count=0.
   Visivamente attenuato (no glow brand) ma cliccabile → mostra toast
   "butta dentro almeno un loop prima di lanciare". */
body.theme-map .actions-propose #btnConferma.inactive {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
}
body.theme-map .actions-propose #btnConferma.inactive:hover {
  background: rgba(255, 255, 255, 0.12);
}
/* v41: stesso pattern per "proponi" stranger inattivo (no loop droppati). */
body.theme-map .actions-invite-new #btnStrangerProponi.inactive {
  background: rgba(167, 139, 250, 0.18);
  color: rgba(255, 255, 255, 0.55);
  box-shadow: none;
  border: 1px solid rgba(167, 139, 250, 0.30);
}
body.theme-map .actions-invite-new #btnStrangerProponi.inactive:hover {
  background: rgba(167, 139, 250, 0.24);
}
/* v41: badge visivo sulla card per stato richiesta */
body.stranger-collecting #btnStrangerProponi,
body.stranger-sent #btnStrangerProponi {
  letter-spacing: 0.01em;
}
/* show only the right action set */
body:not(.mode-invite) .actions-invite-open,
body:not(.mode-invite) .actions-invite-rejected,
body:not(.mode-invite) .actions-invite-new,
body:not(.mode-agenda) .actions-agenda,
body:not(.mode-propose) .actions-propose {
  display: none;
}
body.mode-invite.sub-open .actions-invite-rejected,
body.mode-invite.sub-open .actions-invite-new,
body.mode-invite.sub-rejected .actions-invite-open,
body.mode-invite.sub-rejected .actions-invite-new,
body.mode-invite.sub-new .actions-invite-open,
body.mode-invite.sub-new .actions-invite-rejected {
  display: none;
}
.actions-invite-new { display: flex; gap: 7px; flex-wrap: wrap; justify-content: center; }

.round-btn {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background 0.15s, transform 0.12s, border-color 0.15s, box-shadow 0.18s;
  font-family: inherit;
}
.round-btn:hover { background: rgba(255,255,255,0.16); }
.round-btn:active { transform: scale(0.97); }
/* v28: ghost buttons hanno un "vetro" leggero così restano leggibili
   sopra la mappa anche durante lo scrolling inviti/proposte. */
.round-btn.ghost {
  background: rgba(15, 20, 32, 0.55);
  color: rgba(255,255,255,0.82);
  border-color: rgba(255,255,255,0.18);
}
.round-btn.ghost:hover { background: rgba(15, 20, 32, 0.72); color: #fff; }
.round-btn.danger {
  color: var(--danger);
  border-color: var(--danger-soft);
}
.round-btn.danger:hover {
  background: var(--danger-soft);
  color: #fff;
}

.round-btn.primary-cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  border-color: transparent;
  color: #001a1f;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}
.round-btn.primary-cyan:hover { box-shadow: 0 6px 22px rgba(6, 182, 212, 0.6); }
.round-btn.primary-amber {
  background: linear-gradient(135deg, var(--amber), #f97316);
  border-color: transparent;
  color: #1a0a00;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.4);
}
.round-btn.primary-amber:hover { box-shadow: 0 6px 22px rgba(251, 146, 60, 0.6); }
.round-btn.primary-green {
  background: linear-gradient(135deg, var(--green), #16a34a);
  border-color: transparent;
  color: #001a09;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}
.round-btn.primary-green:hover { box-shadow: 0 6px 22px rgba(34, 197, 94, 0.6); }
/* v37: bottone primario viola — usato per "proponi" su eventi sconosciuti. */
.round-btn.primary-purple {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}
.round-btn.primary-purple:hover { box-shadow: 0 6px 22px rgba(124, 58, 237, 0.6); }

.extend-badge { font-weight: 500; opacity: 0.85; }

.hidden { display: none !important; }

/* ============== TOAST ============== */
.toast {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.20);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============== MODAL ============== */
.modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 300; /* sopra agenda sheet (200) e detail sheet (250) */
}
/* v53.6: modal "top-level" — esce dallo stacking context di #ui per stare
   sopra TUTTO (incluso bottom-nav z:50). Usato per modal che servono in
   contesti dove il parent #ui ha stacking context proprio. */
.modal.modal-toplevel {
  position: fixed;
  z-index: 9999;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: backdropIn 0.2s ease-out;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  /* v53.22.14: sfondo modale → viola scuro #210040 (richiesta utente). */
  background: #210040;
  border-top: 1px solid rgba(255,255,255,0.10);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 540px;
  padding: 14px 20px 22px;
  box-shadow: 0 -16px 50px rgba(0, 0, 0, 0.6);
  animation: cardUp 0.3s cubic-bezier(.2, .8, .2, 1);
}
.modal-small { padding: 14px 20px 20px; }
@keyframes cardUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-handle {
  width: 40px; height: 3px;
  background: rgba(255,255,255,0.20);
  border-radius: 2px;
  margin: 0 auto 14px;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.modal-subtitle {
  font-size: 12.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
}

.accept-summary, .cancel-warning {
  font-size: 12.5px;
  color: rgba(255,255,255,0.78);
  margin: 12px 0 8px;
  line-height: 1.5;
}
.cancel-warning {
  background: var(--danger-soft);
  color: var(--danger-bright);
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 2px solid var(--danger);
}
.accept-extends {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.extends-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cyan-bright);
  margin-bottom: 8px;
}

.modal-loops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}
.modal-loop-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid;
  font-size: 12px;
  color: #fff;
  font-weight: 500;
}
.modal-loop-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 9px currentColor;
}

.modal-tabs {
  display: flex;
  gap: 8px;
  margin: 12px 0 10px;
}
.tab {
  flex: 1;
  padding: 11px 11px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  font-family: inherit;
}
.tab:hover { background: rgba(255,255,255,0.10); }
.tab.active {
  background: var(--amber-soft);
  border-color: var(--amber-dim);
  color: #fff;
}
.tab-title {
  font-size: 12px;
  font-weight: 600;
  display: block;
}
.tab-sub {
  font-size: 10.5px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
  display: block;
}
.tab.active .tab-sub { color: var(--amber-bright); }

.mode-explainer {
  font-size: 11.5px;
  color: rgba(255,255,255,0.72);
  background: rgba(255,255,255,0.03);
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 2px solid var(--amber);
  line-height: 1.55;
}

.loop-info-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.loop-info-photo-wrap {
  width: 56px; height: 56px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.4);
  flex-shrink: 0;
}
.loop-info-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.loop-info-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.loop-info-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.loop-info-members {
  font-size: 11.5px;
  color: rgba(255,255,255,0.60);
}
.loop-info-status {
  font-size: 11.5px;
  padding: 7px 11px;
  border-radius: 9px;
  margin-bottom: 10px;
  border-left: 2px solid;
}
.loop-info-status.s-confirmed {
  background: var(--green-soft);
  color: var(--green-bright);
  border-left-color: var(--green);
}
.loop-info-status.s-pending {
  background: var(--yellow-soft);
  color: var(--yellow);
  border-left-color: var(--yellow);
}
.loop-info-status.s-declined {
  background: var(--danger-soft);
  color: var(--danger-bright);
  border-left-color: var(--danger);
}
.loop-info-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  padding: 9px 11px;
  background: rgba(255,255,255,0.04);
  border-radius: 9px;
}
.loop-info-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  align-items: center;
  gap: 12px;
}
.loop-info-meta-key {
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 9.5px;
  flex-shrink: 0;
}
.loop-info-meta-val {
  color: #fff;
  font-weight: 500;
  text-align: right;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.ghost-btn, .primary-btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s, background 0.15s;
  font-family: inherit;
}
.ghost-btn {
  background: transparent;
  border-color: rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.65);
}
.ghost-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.primary-btn.primary-amber {
  background: linear-gradient(135deg, var(--amber), #f97316);
  color: #1a0a00;
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.4);
}
.primary-btn.primary-cyan {
  background: linear-gradient(135deg, var(--cyan), #0891b2);
  color: #001a1f;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}
.primary-btn.primary-green {
  background: linear-gradient(135deg, var(--green), #16a34a);
  color: #001a09;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}
/* v41: variante viola per "invia richiesta" stranger event */
.primary-btn.primary-purple {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #fff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}
.primary-btn.primary-purple:hover { box-shadow: 0 6px 22px rgba(124, 58, 237, 0.6); }
.primary-btn.primary-danger {
  background: linear-gradient(135deg, var(--danger), #ef4444);
  color: #1a0000;
  box-shadow: 0 4px 16px rgba(248, 113, 113, 0.4);
}
.ghost-btn:active, .primary-btn:active { transform: scale(0.97); }

/* ============================================================
   THEME: MAP (experiment/map-theme)
   ============================================================
   Sostituisce il tema spaziale (stelle, buco nero) con mappa di Milano
   come sfondo. Il canvas custom resta sopra per disegnare card+loop.
   ============================================================ */

/* === Mapbox container (layer 0, sotto canvas) === */
#mapboxContainer {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  background: #0a0e1a;
  /* v9: ammorbidisco saturazione e contrasto della mappa così non compete
     visivamente con gli elementi interagibili (card, pill, bottoni).
     Mantengo brightness moderato per leggibilità dei nomi (stazioni, metro,
     vie principali). NB: i fork CSS filter applicano anche ai marker
     interattivi sopra → bilanciamento accurato. */
  filter: saturate(0.55) contrast(0.92) brightness(1.04);
}

/* Quando in theme-map, il canvas custom è SOPRA la mappa */
body.theme-map #scene {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  pointer-events: auto;
  background: transparent;
}

/* Tutta la UI deve stare SOPRA canvas e mappa.
   IMPORTANTE: mantenere position: absolute + inset: 0 dal CSS base
   (altrimenti flex column con margin-top:auto su #bottomActions si rompe).
   Sovrascrivo SOLO z-index. */
body.theme-map #ui {
  /* v9: 10 invece di 2, così tutti i suoi figli (dropdown z=100 dentro)
     stiano sopra il loopPageBtn appeso a body root (z=5). */
  z-index: 10;
}

/* Body in theme-map: niente sfondo nero, la mappa fa da sfondo */
body.theme-map {
  background: transparent;
}

/* Nascondi elementi del tema spaziale che non hanno più senso */
body.theme-map .star,
body.theme-map .nebula-glow {
  display: none;
}

/* === Filtri mappa (città + data) ===
   Posizionati SUBITO sotto la topbar (top 50 invece di 56) per lasciare
   più aria alla card sotto. La topbar ha padding-top ridotto per matching. */
.map-filters {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 50px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 6;
  padding: 0 12px;
}

/* MAP THEME: sub-tabs (aperti/rifiutati) posizionati SOTTO i filtri come fixed
   per non essere coperti. In flex flow originale i sub-tabs erano dietro i
   filtri fixed con z-index 6. Ora sub-tabs sono fixed sopra. */
body.theme-map.mode-invite .sub-tabs {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 92px);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 6;
  background: rgba(15, 20, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* v21: in invite mode i pill DATA + CITTÀ NON sono filtri ma INFO FISSE
   dell'invito (l'evento è già scelto, l'utente non può cambiarli).
   - Bordo + glow CYAN per invite-open (coerente con alone card)
   - Bordo + glow ROSSO per invite-rejected
   - pointer-events:none (non cliccabili)
   - opacity: 1 (info, non disabled — il glow comunica "fisso")
   v29: in overview-mode (utente è sulla MAPPA) i pill tornano cliccabili
   anche se currentMode è ancora 'invite' — vedi override più in basso. */
body.theme-map.mode-invite #filterDateBtn,
body.theme-map.mode-invite #filterCityBtn {
  pointer-events: none;
  cursor: default;
  opacity: 1;
}
/* v29: override base — in overview i filtri sono cliccabili. */
body.theme-map.overview-mode #filterDateBtn,
body.theme-map.overview-mode #filterCityBtn {
  pointer-events: auto;
  cursor: pointer;
}
body.theme-map.mode-invite.sub-open #filterDateBtn,
body.theme-map.mode-invite.sub-open #filterCityBtn {
  border-color: rgba(6, 182, 212, 0.65);
  box-shadow:
    0 0 0 1px rgba(6, 182, 212, 0.35) inset,
    0 0 14px rgba(6, 182, 212, 0.55);
  color: #67e8f9;
}
/* v26: se l'invito attuale è PENDING (proposal con quorum) → pill GIALLI
   invece di cyan. Override applicato via body.invite-pending. */
body.theme-map.mode-invite.invite-pending #filterDateBtn,
body.theme-map.mode-invite.invite-pending #filterCityBtn {
  border-color: rgba(250, 204, 21, 0.70);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.42) inset,
    0 0 14px rgba(250, 204, 21, 0.60);
  color: #fde68a;
}
body.theme-map.mode-invite.sub-rejected #filterDateBtn,
body.theme-map.mode-invite.sub-rejected #filterCityBtn {
  border-color: rgba(248, 113, 113, 0.65);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.35) inset,
    0 0 14px rgba(248, 113, 113, 0.55);
  color: #fca5a5;
}
/* Chevron meno visibile (non c'è dropdown attivo in invite) */
body.theme-map.mode-invite .mf-chev {
  opacity: 0.35;
}

/* v30: in overview-mode i filtri devono tornare NEUTRI anche se il
   body conserva ancora mode-invite/sub-open/sub-rejected/invite-pending.
   Questa regola arriva DOPO le precedenti → vince per ordine cascade.
   Doppia classe overview-mode + mode-invite per specificità superiore. */
body.theme-map.overview-mode.mode-invite #filterDateBtn,
body.theme-map.overview-mode.mode-invite #filterCityBtn,
body.theme-map.overview-mode #filterDateBtn,
body.theme-map.overview-mode #filterCityBtn {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: none;
  color: #fff;
}
body.theme-map.overview-mode .mf-chev {
  opacity: 0.7;
}

.map-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(15, 20, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}

.map-filter-pill:hover {
  background: rgba(25, 32, 45, 0.92);
}

.map-filter-pill:active {
  transform: scale(0.96);
}

.map-filter-pill .mf-icon {
  font-size: 12px;
  opacity: 0.8;
}

.map-filter-pill .mf-label {
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.map-filter-pill .mf-chev {
  font-size: 9px;
  opacity: 0.6;
  margin-left: 2px;
}

/* === Dropdown filtri (apre da pill) === */
.map-dropdown {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 110px);
  /* v9: background FULLY OPAQUE per coprire tutto sotto (titolo card,
     loop, ecc.). Prima era 0.96 → trasparenza visibile attraverso il testo. */
  background: rgb(12, 18, 28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  padding: 8px;
  /* v9: z-index ALTO per stare sopra tutto (canvas, card, bottoni, tray). */
  z-index: 100;
  min-width: 180px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  animation: dropdownIn 0.18s ease-out;
}

.map-dropdown.hidden {
  display: none;
}

#cityDropdown {
  left: 50%;
  transform: translateX(calc(-50% - 60px));
}

/* v53.12: #dateDropdown ora è popup modal — le regole map-dropdown legacy
   sono override sotto via .date-picker-modal. */
#dateDropdown.date-picker-modal {
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  transform: none;
  max-height: none;
  overflow: visible;
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
}

.md-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  font-size: 13.5px;
  color: #fff;
  gap: 12px;
}

.md-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.md-item.active {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan-bright);
}

.md-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.md-item .md-name {
  font-weight: 500;
}

.md-item .md-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  font-family: 'SF Mono', Menlo, monospace;
}

.md-item .md-check {
  color: var(--cyan-bright);
  font-size: 14px;
}

.md-item .md-soon {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.5);
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to { opacity: 1; }
}

#cityDropdown {
  animation-name: dropdownInCity;
}

#dateDropdown {
  animation-name: dropdownInDate;
}

@keyframes dropdownInCity {
  from { opacity: 0; transform: translateX(calc(-50% - 60px)) translateY(-6px); }
  to { opacity: 1; transform: translateX(calc(-50% - 60px)) translateY(0); }
}

@keyframes dropdownInDate {
  from { opacity: 0; transform: translateX(calc(-50% + 60px)) translateY(-6px); }
  to { opacity: 1; transform: translateX(calc(-50% + 60px)) translateY(0); }
}

/* === Backdrop per UI sopra mappa (leggibilità) ===
   v28: usiamo un pseudo-element ::before per avere il blur sfumato via
   mask-image (CSS mask). Il fade è "naturale" — niente bordo netto. */
body.theme-map #topbar {
  position: relative;
  padding-top: 8px;
  padding-bottom: 14px;
  background: transparent;
  /* I figli devono stare sopra il backdrop sfumato */
  z-index: 5;
}
body.theme-map #topbar::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(3, 6, 16, 0.78) 0%,
    rgba(3, 6, 16, 0.55) 45%,
    rgba(3, 6, 16, 0.20) 80%,
    rgba(3, 6, 16, 0) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
  z-index: -1;
}

/* Bottom actions: v28 — backdrop sfumato via mask-image (uguale al topbar
   ma invertito), così la mappa "si schiarisce" gradualmente sopra i tasti. */
body.theme-map #bottomActions {
  position: relative;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 58px);
  padding-top: 18px;
  background: transparent;
  z-index: 5;
}
body.theme-map #bottomActions::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(8, 12, 22, 0) 0%,
    rgba(8, 12, 22, 0.22) 35%,
    rgba(8, 12, 22, 0.55) 70%,
    rgba(8, 12, 22, 0.78) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  -webkit-mask-image: linear-gradient(0deg, #000 0%, #000 50%, transparent 100%);
  mask-image: linear-gradient(0deg, #000 0%, #000 50%, transparent 100%);
  z-index: -1;
}

/* === TRAY RADICALE v4: liquid glass DENTRO #bottomActions === */
/* Il tray è ora primo figlio di #bottomActions (flex column).
   Sta SEMPRE sopra i bottoni in modo nativo, qualsiasi numero di righe
   essi occupino. Niente position fixed, niente offset calcolati. */
body.theme-map #droppedTray {
  position: static;
  align-self: center;
  margin: 0;
  left: auto;
  transform: none;
  top: auto;
  bottom: auto;
  width: min(360px, calc(100vw - 24px));
  min-height: 56px;
  padding: 8px 12px;
  background: rgba(20, 26, 38, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 32px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  z-index: 5;
  overflow: hidden;
}

body.theme-map #droppedTray.hidden {
  display: none;
}

body.theme-map .dropped-tray-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding: 0 6px;
}

body.theme-map .dropped-tray-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.65);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

/* v19: in invite-open, header "INVITO DA: NOME" più EVIDENTE.
   Sfondo glow cyan, font più grande, contrasto rinforzato. */
body.theme-map.mode-invite.sub-open .dropped-tray-header {
  margin-bottom: 8px;
  padding: 6px 10px;
  background: linear-gradient(90deg,
    rgba(6, 182, 212, 0.22) 0%,
    rgba(6, 182, 212, 0.10) 60%,
    rgba(6, 182, 212, 0) 100%);
  border-radius: 10px;
  border: 1px solid rgba(6, 182, 212, 0.32);
}
body.theme-map.mode-invite.sub-open .dropped-tray-label {
  font-size: 11px;
  font-weight: 700;
  color: #67e8f9;
  letter-spacing: 0.08em;
}
/* v40: tray per eventi sconosciuti (sub-new) — label viola con
   organizzatore sconosciuto visibile. */
body.theme-map.mode-invite.sub-new .dropped-tray-label {
  font-size: 11px;
  font-weight: 700;
  color: #c4b5fd;
  letter-spacing: 0.08em;
}
body.theme-map.mode-invite.sub-new .dropped-tray-header {
  background: linear-gradient(135deg,
    rgba(167, 139, 250, 0.22) 0%,
    rgba(167, 139, 250, 0.10) 60%,
    rgba(167, 139, 250, 0) 100%);
  border-radius: 10px;
  border: 1px solid rgba(167, 139, 250, 0.32);
}

body.theme-map .dropped-tray-count {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 7px;
  border-radius: 999px;
  font-family: 'SF Mono', Menlo, monospace;
}

body.theme-map .dropped-tray-clearall {
  margin-left: auto;
  font-size: 10px;
  background: rgba(248, 113, 113, 0.08);
  color: rgba(248, 113, 113, 0.85);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 999px;
  padding: 3px 9px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

body.theme-map .dropped-tray-clearall:hover {
  background: rgba(248, 113, 113, 0.18);
}

/* Strip sfere scrollabile orizzontalmente (single row, no wrap) */
body.theme-map .dropped-chips {
  display: flex;
  flex-wrap: nowrap;            /* CRITICO: niente wrap, solo scroll */
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 6px;
  scrollbar-width: none; /* Firefox */
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  /* Larghezza variabile fino al limite */
  min-width: 0;
}

body.theme-map .dropped-chips::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

/* Le "chip" diventano ORB: sfere circolari, no testo */
body.theme-map .dropped-chip {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid;
  background: rgba(255, 255, 255, 0.06);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  scroll-snap-align: start;
  overflow: visible;
  transition: transform 0.15s;
}

body.theme-map .dropped-chip:hover {
  transform: scale(1.08);
}

body.theme-map .dropped-chip:active {
  transform: scale(0.94);
}

/* Loop orb: foto loop centrale (legge da img inserita da JS), tooltip sopra */
body.theme-map .dropped-chip-loop {
  /* Aggiunge un'immagine come content (gestito da JS rendering chip) */
}

body.theme-map .dropped-chip-loop > span:not(.dropped-chip-plus):not(.dropped-chip-status) {
  /* Nasconde solo il testo nome loop, NON il badge +N né lo status (✓/⌛) */
  display: none;
}

body.theme-map .dropped-chip-loop::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background-image: var(--orb-bg, none);
  background-size: cover;
  background-position: center;
}

/* Person orb: avatar foto, più piccola, prefisso "+" sopra */
body.theme-map .dropped-chip-person {
  width: 32px;
  height: 32px;
  border-style: dashed;
  opacity: 0.92;
}

/* v14: nascondi nome persona MA NON il badge status (✓/⌛) né il + count */
body.theme-map .dropped-chip-person > span:not(.dropped-chip-status):not(.dropped-chip-plus) {
  display: none;
}

body.theme-map .dropped-chip-person::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background-image: var(--orb-bg, none);
  background-size: cover;
  background-position: center;
}

/* Pulsante × posizionato in alto a destra sulla sfera */
body.theme-map .dropped-chip-x {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(15, 20, 28, 0.95);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  z-index: 2;
}

body.theme-map .dropped-chip-x:hover {
  background: rgba(248, 113, 113, 0.9);
  color: #fff;
}

/* Badge "+N" sui loop con collegamenti droppati (aggregati) */
body.theme-map .dropped-chip-plus {
  position: absolute;
  bottom: -3px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  color: #0a0a14;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(15, 20, 28, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 2;
  line-height: 1;
  font-family: 'SF Mono', Menlo, monospace;
}

/* v11/v19: chip lockato (partecipanti iniziali dell'invito).
   Non rimovibile, badge status accepted/pending/declined.
   Bordo SOLID (vs dashed dei droppati utente) per distinzione visiva. */
body.theme-map .dropped-chip-locked {
  opacity: 1;
  border-style: solid;
}
/* v19: chip droppati dall'utente (estensione) → bordo DASHED per
   distinguere dai chip lockati invitati. */
body.theme-map .dropped-chip-loop:not(.dropped-chip-locked),
body.theme-map .dropped-chip-person:not(.dropped-chip-locked) {
  border-style: dashed;
}
body.theme-map .dropped-chip-status {
  position: absolute;
  bottom: -3px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #0a0a14;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(15, 20, 28, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 2;
  line-height: 1;
  font-family: 'SF Mono', Menlo, monospace;
}

/* v15: chip MITTENTE — bordo cyan brand glow + alone leggero */
body.theme-map .dropped-chip-sender {
  box-shadow:
    0 0 0 2px rgba(6, 182, 212, 0.22),
    0 0 14px rgba(6, 182, 212, 0.55);
}

/* v19: divider grafico più EVIDENTE tra chip lockati (invitati originali)
   e chip nuovi (estensioni utente). Pill con label "estendi" sopra. */
body.theme-map .dropped-chip-divider {
  flex-shrink: 0;
  align-self: stretch;
  width: 2px;
  margin: 2px 10px;
  background: linear-gradient(to bottom,
    rgba(255, 255, 255, 0) 0%,
    rgba(103, 232, 249, 0.55) 25%,
    rgba(103, 232, 249, 0.55) 75%,
    rgba(255, 255, 255, 0) 100%);
  border-radius: 2px;
  position: relative;
}
/* Label "estendi" sopra il divider (verticale) */
body.theme-map .dropped-chip-divider::after {
  content: 'estendi';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 7px;
  font-weight: 700;
  color: rgba(103, 232, 249, 0.92);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: rgba(20, 26, 38, 0.96);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid rgba(103, 232, 249, 0.35);
  white-space: nowrap;
}

body.theme-map .sub-tabs {
  background: rgba(15, 20, 30, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 4px;
}

/* Pill top 5/altri loop: contrasto rinforzato su mappa chiara */
body.theme-map .loop-page-btn {
  background: rgba(15, 20, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.20);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
body.theme-map .loop-page-btn:hover {
  background: rgba(25, 32, 45, 0.92);
}
body.theme-map .loop-page-btn:active {
  transform: translateX(-50%) scale(0.94);
}

/* === v16 · Overview mode (pinch-out → tutti gli eventi del giorno) === */
body.theme-map.overview-mode #scene {
  /* canvas card+loop: fade-out smooth */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}
body.theme-map:not(.overview-mode) #scene {
  opacity: 1;
  transition: opacity 0.32s ease;
}
body.theme-map.overview-mode #holeContent {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease;
}
body.theme-map.overview-mode #bottomActions,
body.theme-map.overview-mode #droppedTray,
body.theme-map.overview-mode #inviteSubTabs,
body.theme-map.overview-mode #loopPageBtn,
body.theme-map.overview-mode #cardHintTooltip {
  display: none !important;
}

/* v32: wrapper marker + label sotto. Mapbox posiziona il wrap al
   centro delle coords; il pin (.map-marker) sta sopra, la label sotto. */
.map-marker-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.map-marker-label {
  /* v53.12: ridotto da 9.5/2-7 → 7.5/1-5 — label molto più compatte,
     accettabile per ridotto numero di stati (1-2 parole). */
  font-size: 7.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(15, 20, 30, 0.85);
  padding: 1px 5px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.map-marker-wrap:has(.map-marker-pending-invited) .map-marker-label,
.map-marker-wrap:has(.map-marker-pending-organized) .map-marker-label {
  font-size: 7px;
  background: rgba(120, 90, 0, 0.92);
  border-color: rgba(250, 204, 21, 0.45);
  color: #fde68a;
}

/* Marker eventi (overview mode) — pill colorato per categoria.
   v16 fix: NIENTE transform: scale() su hover/active perché Mapbox setta
   inline style.transform="translate(x,y)" per posizionare → un override
   transform CSS lo cancella, e durante il pan i marker "ballano".
   Per feedback uso filter brightness + box-shadow.
   v30: saturation/contrast boost per marker più "accesi" sopra la mappa
   chiara. Bordo nero sottile per separazione anziché bianco "lavato". */
.map-marker {
  /* v53.12 / fix UI: dimensione UNIFORME 26px per tutti i marker (era
     34-40px). Ridotto per non sovraccaricare la mappa. Le distinzioni
     stato → colore + glow ring (no più size diversa). */
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: filter 0.15s, box-shadow 0.15s;
  background: #fb923c;
  padding: 0;
  line-height: 1;
  filter: saturate(1.1);
  z-index: 2;
  will-change: transform;
  backface-visibility: hidden;
}
.map-marker:hover {
  filter: saturate(1.2) brightness(1.08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.map-marker:active {
  filter: saturate(1) brightness(0.9);
}

/* v53.12 / fix UI: TUTTI i marker tipizzati hanno la STESSA dimensione (26px,
   ereditata da .map-marker base). Le distinzioni stato sono SOLO via:
   - background color (palette per categoria)
   - glow ring (no più pulse animazione invadente)
   - bordo
   Niente più "size scaling" per importanza. */

/* INVITO CONCRETO (devo accettare) — cyan CHIARO (#22d3ee = brand bright cyan).
   Ring glow leggero, NIENTE pulse. */
.map-marker.map-marker-invite {
  background: #22d3ee;
  box-shadow:
    0 0 0 2px rgba(34, 211, 238, 0.50),
    0 0 10px rgba(34, 211, 238, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* PENDING INVITED (proposta da accettare, attesa quorum) — giallo dashed */
.map-marker.map-marker-pending-invited {
  background: #facc15;
  border-style: dashed;
  box-shadow:
    0 0 0 2px rgba(250, 204, 21, 0.45),
    0 0 9px rgba(250, 204, 21, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* PENDING ORGANIZED (mio evento, attesa quorum) — ambra dashed */
.map-marker.map-marker-pending-organized {
  background: #f59e0b;
  border-style: dashed;
  box-shadow:
    0 0 0 2px rgba(245, 158, 11, 0.50),
    0 0 9px rgba(245, 158, 11, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* RIFIUTATO — rosso */
.map-marker.map-marker-rejected {
  background: #f87171;
  box-shadow:
    0 0 0 2px rgba(248, 113, 113, 0.55),
    0 0 9px rgba(248, 113, 113, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* MIO EVENTO (organizzato) — arancio acceso */
.map-marker.map-marker-organized {
  background: #fb923c;
  box-shadow:
    0 0 0 2px rgba(251, 146, 60, 0.55),
    0 0 10px rgba(251, 146, 60, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* PARTECIPO (invito accettato) — cyan SCURO (#0891b2 = teal scuro).
   Distinzione chiara da invito (cyan chiaro): inviti = azione pendente,
   partecipo = committed/maturo. */
.map-marker.map-marker-participate {
  background: #0891b2;
  box-shadow:
    0 0 0 2px rgba(8, 145, 178, 0.55),
    0 0 10px rgba(8, 145, 178, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 3;
}

/* v51: marker proposte (Eventbrite/venue/activity) — PIENE on-date.
   La gerarchia con inviti/eventi tuoi è data da:
   - dimensione minore (26 vs 38-40px) — "contesto" non "azione"
   - z-index 1 (vs 3) — sotto in caso di sovrapposizione
   - glow ring più sottile — non pulsano
   ma opacity 1 e colore saturo per essere SEMPRE ben visibili. */
.map-marker.map-marker-eventbrite,
.map-marker.map-marker-venue,
.map-marker.map-marker-activity {
  width: 26px;
  height: 26px;
  font-size: 12px;
  opacity: 1;
  z-index: 1;
  border: 2px solid #fff;
  box-shadow:
    0 0 0 1.5px rgba(251, 146, 60, 0.45),
    0 0 8px rgba(251, 146, 60, 0.25),
    0 2px 8px rgba(0, 0, 0, 0.35);
}
.map-marker.map-marker-eventbrite:hover,
.map-marker.map-marker-venue:hover,
.map-marker.map-marker-activity:hover {
  filter: saturate(1.2) brightness(1.08);
  box-shadow:
    0 0 0 2px rgba(251, 146, 60, 0.55),
    0 0 14px rgba(251, 146, 60, 0.45),
    0 4px 12px rgba(0, 0, 0, 0.4);
}

/* STRANGER — viola chiaro (auto-approve) o viola scuro (manual approval).
   Stesso size 26px degli altri, niente pulse animation. */
.map-marker.map-marker-stranger {
  z-index: 3;
}
.map-marker.map-marker-stranger-auto {
  background: #a78bfa;
  box-shadow:
    0 0 0 2px rgba(167, 139, 250, 0.55),
    0 0 10px rgba(167, 139, 250, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
}
.map-marker.map-marker-stranger-manual {
  background: #7c3aed;
  box-shadow:
    0 0 0 2px rgba(124, 58, 237, 0.55),
    0 0 10px rgba(124, 58, 237, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35);
}
/* STRANGER RIFIUTATO — alone rosso sopra il viola */
.map-marker.map-marker-stranger-rejected {
  background: #f87171 !important;
  box-shadow:
    0 0 0 2px rgba(167, 139, 250, 0.45),
    0 0 10px rgba(248, 113, 113, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35) !important;
}
/* STRANGER con richiesta INVIATA pending — bordo giallo */
.map-marker.map-marker-stranger.map-marker-stranger-pending {
  box-shadow:
    0 0 0 2px rgba(250, 204, 21, 0.55),
    0 0 10px rgba(167, 139, 250, 0.50),
    0 2px 8px rgba(0, 0, 0, 0.35) !important;
}
/* PARTECIPI DA STRANGER (evento conquistato candidandomi) — halo viola sopra cyan scuro */
.map-marker.map-marker-participate.map-marker-from-stranger {
  box-shadow:
    0 0 0 2px rgba(167, 139, 250, 0.55),
    0 0 10px rgba(8, 145, 178, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35) !important;
}

/* v53.12 (Sessione A): regole .map-marker-off-date RIMOSSE.
   La mappa ora mostra solo eventi del selectedDate a piena opacità.
   Niente più trasparenze "fuori-giorno". */

/* ============================================================
 * v53.12 · POPUP CALENDAR MENSILE (filtro data)
 * Calendario tradizionale 7 colonne × 6 righe. Header con mese +
 * frecce navigation. Celle giorno cliccabili con pallini impegni.
 * ============================================================ */
.date-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}
.date-picker-modal.hidden { display: none; }
.date-picker-modal .modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}
.date-picker-card {
  position: relative;
  z-index: 2;
  width: min(100%, 380px);
  max-width: calc(100vw - 24px);
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 100%);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  padding: 14px 14px 12px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.65);
  animation: dpFadeIn 0.22s ease-out;
}
@keyframes dpFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}
/* Header: frecce + nome mese */
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}
.dp-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
}
.dp-nav-btn:active { transform: scale(0.92); }
.dp-nav-btn:hover { background: rgba(255, 255, 255, 0.10); }
.dp-month-label {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
/* Riga giorni settimana */
.dp-wd-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 6px;
  padding: 0 2px;
}
.dp-wd {
  text-align: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  padding: 4px 0;
}
/* Griglia giorni — 6 settimane × 7 colonne */
.dp-grid-month {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.dp-cell {
  aspect-ratio: 1 / 1;
  min-height: 38px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: inherit;
  position: relative;
}
/* Celle vuote (prima del 1° del mese o dopo l'ultimo) */
.dp-cell-empty {
  pointer-events: none;
}
/* Celle giorno standard — v53.12 fix: contrasto aumentato per renderle
   chiaramente cliccabili anche quando non hanno impegni (passati o futuri).
   Lo "spento" che fa pensare a disabled è stato eliminato. */
.dp-cell-day {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  padding: 0;
}
.dp-cell-day .dp-cell-num { color: rgba(255,255,255,0.92); }
.dp-cell-day:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.30);
}
.dp-cell-day:active { transform: scale(0.95); }
/* Cella selezionata — bordo verde brillante (vedi screen utente) */
.dp-cell-day.dp-cell-selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.10);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.45);
  color: #fff;
}
.dp-cell-day.dp-cell-selected .dp-cell-num { color: #fff; font-weight: 800; }
/* v53.12 fix B.e: Cella OGGI molto evidente — bordo doppio cyan acceso +
   gradient di sfondo + badge "OGGI" sopra al numero + pulse leggero. */
.dp-cell-day.dp-cell-today {
  border-color: #22d3ee;
  border-width: 2px;
  background: linear-gradient(160deg, rgba(34, 211, 238, 0.20), rgba(34, 211, 238, 0.08));
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 12px rgba(34, 211, 238, 0.30);
  animation: dpTodayPulse 2.4s ease-in-out infinite;
}
@keyframes dpTodayPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45), 0 0 12px rgba(34, 211, 238, 0.30); }
  50%      { box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.65), 0 0 18px rgba(34, 211, 238, 0.55); }
}
.dp-cell-day.dp-cell-today .dp-cell-num { color: #cffafe; font-weight: 800; font-size: 16px; }
.dp-cell-today-label {
  position: absolute;
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #22d3ee;
  background: rgba(15, 23, 42, 0.92);
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1;
}
/* Se OGGI è anche selezionato → priorità al verde della selezione, ma
   manteniamo il pulse cyan per riconoscere il "today" */
.dp-cell-day.dp-cell-today.dp-cell-selected {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
}
.dp-cell-day.dp-cell-today.dp-cell-selected .dp-cell-num { color: #fff; }
/* Cella con impegni utente — leggero hint visivo */
.dp-cell-day.dp-cell-has-events {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
}
.dp-cell-num {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.dp-cell-dots {
  display: flex;
  flex-direction: row;
  gap: 2px;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.dp-cell-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}
.dp-cell-dot-organized   { background: #fb923c; box-shadow: 0 0 3px rgba(251, 146, 60, 0.7); }
.dp-cell-dot-participate { background: #0891b2; box-shadow: 0 0 3px rgba(8, 145, 178, 0.7); }
.dp-cell-dot-invite      { background: #22d3ee; box-shadow: 0 0 3px rgba(34, 211, 238, 0.7); animation: dpDotPulse 1.5s ease-in-out infinite; }
@keyframes dpDotPulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
/* Legenda piè di pagina */
.date-picker-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  justify-content: center;
  padding: 12px 4px 4px;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.65);
}
.dp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.dp-legend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dp-legend-dot.dp-legend-organized   { background: #fb923c; }
.dp-legend-dot.dp-legend-participate { background: #0891b2; }
.dp-legend-dot.dp-legend-invite      { background: #22d3ee; }

/* ============================================================
 * v53.12 (Sessione C) · HOT ZONES — cerchio ROSSO lampeggiante.
 * Niente label testuale (solo il cerchio comunica). Sotto le icone marker.
 * ============================================================ */
.hot-zone-wrap {
  position: relative;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hot-zone-glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.30);
  border: 2px solid rgba(220, 38, 38, 0.78);
  box-shadow:
    inset 0 0 30px rgba(239, 68, 68, 0.30),
    0 0 16px rgba(239, 68, 68, 0.40);
  animation: hotZonePulse 1.8s ease-in-out infinite;
}
@keyframes hotZonePulse {
  0%, 100% { transform: scale(1);    opacity: 1;    }
  50%      { transform: scale(1.08); opacity: 0.65; }
}

/* ============================================================
 * v53.12 (Sessione B) · BADGE "MAPPA LIVE"
 * Visibile solo in overview-mode quando selectedDate = MOCK_TODAY_DATE.
 * Indica che le posizioni dei membri sono real-time.
 * ============================================================ */
.live-map-badge {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 165px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.92), rgba(185, 28, 28, 0.85));
  border: 1px solid rgba(248, 113, 113, 0.55);
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.10em;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.45);
  text-transform: uppercase;
  pointer-events: none;
}
.live-map-badge.hidden { display: none; }
.live-map-badge .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
  animation: liveBlink 1.4s ease-in-out infinite;
}
@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.78); }
}

/* ============================================================
 * v53.12 (Sessione B) · MEMBRI LOOP SULLA MAPPA + TOOLTIP
 * ============================================================ */
.member-marker-wrap {
  pointer-events: auto;
}
/* Avatar singolo membro — cerchio piccolo con foto, bordo del loop primario */
.member-single-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #1f2937;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 0.12s;
}
.member-single-avatar:active { transform: scale(0.92); }
.member-single-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* Orb CLUSTER LOOP — foto del LOOP (non di un membro) + badge "+N" piccolo
   in basso-dx. Tap → tooltip con lista membri reali. */
.member-cluster-orb {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  background: #1f2937;
  padding: 0;
  cursor: pointer;
  overflow: visible;
  position: relative;
  transition: transform 0.12s;
}
.member-cluster-orb:active { transform: scale(0.93); }
.member-cluster-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.member-cluster-badge {
  position: absolute;
  bottom: -4px;
  right: -6px;
  min-width: 18px;
  height: 16px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  color: #0a0f1a;
  border: 1.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.02em;
}
/* Tooltip al tap — posizionato fixed sopra il marker */
.member-tooltip {
  position: fixed;
  z-index: 1000;
  min-width: 180px;
  max-width: 260px;
  background: linear-gradient(160deg, #1e293b, #0f172a);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px;
  animation: mtFadeIn 0.18s ease-out;
}
@keyframes mtFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mt-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.mt-loop-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 5px currentColor;
}
.mt-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.mt-meta {
  font-size: 10.5px;
  color: rgba(255,255,255,0.65);
  line-height: 1.35;
  margin-bottom: 8px;
}
.mt-msg-btn {
  width: 100%;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.15);
  border: 1px solid rgba(34, 211, 238, 0.40);
  color: #67e8f9;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.mt-msg-btn:hover { background: rgba(34, 211, 238, 0.22); }
.mt-msg-btn:active { transform: scale(0.97); }
/* v53.12 fix B.b: lista membri nel tooltip cluster */
.mt-cluster-badge {
  margin-left: auto;
  min-width: 22px;
  height: 16px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  color: #0a0f1a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  font-family: 'SF Mono', Menlo, monospace;
}
.mt-member-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0 10px;
  padding: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
}
.mt-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mt-member-photo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.mt-member-info {
  flex: 1;
  min-width: 0;
}
.mt-member-name {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mt-member-time {
  font-size: 9.5px;
  color: rgba(255,255,255,0.50);
}

/* ============================================================
 * v53.12 (Sessione A) · USER LOCATION DOT
 * Puntino blu stile Apple Maps con cerchio pulsante esterno.
 * Posizionato fisso su Viale Argonne (mock). In Flutter sarà GPS reale.
 * ============================================================ */
.user-location-wrap {
  position: relative;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.user-location-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #2563eb;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.45),
              0 2px 8px rgba(37, 99, 235, 0.45);
  z-index: 2;
}
.user-location-pulse {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
  z-index: 1;
  animation: userLocPulse 2s ease-out infinite;
}
@keyframes userLocPulse {
  0%   { transform: translate(-50%, -50%) scale(0.7); opacity: 0.9; }
  70%  { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}

/* FAB "portami qui" — visibile solo in overview-mode, in basso a destra.
   Tap → flyTo USER_LOCATION. */
.center-on-user-btn {
  position: fixed;
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 1px solid rgba(37, 99, 235, 0.45);
  background: rgba(15, 23, 42, 0.92);
  color: #60a5fa;
  font-size: 18px;
  display: none; /* default hidden — toggled by .overview-mode body class */
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45),
              0 0 0 2px rgba(37, 99, 235, 0.12) inset;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.15s, background 0.15s;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.center-on-user-btn:active { transform: scale(0.93); }
.center-on-user-btn:hover  { background: rgba(30, 41, 59, 0.95); }
body.theme-map.overview-mode .center-on-user-btn { display: flex; }

/* v17: vecchio bottone overview separato (.overview-toggle-btn) RIMOSSO.
   Sostituito da tab "MAPPA" dentro #modeSwitcher (vedi .mode-tab.tab-map). */

/* v16 fix: in overview mode, canvas pointer-events: none così la mappa
   è LIBERA per zoom/pan/drag come Google Maps. */
body.theme-map.overview-mode #scene {
  pointer-events: none !important;
}

/* ============== v20 · BOTTOM NAV BAR (navigazione globale) ============== */
/* Sempre fixed in basso, 4 tab: Mappa | Nebula | Feed | Chat.
   Sopra TUTTO il resto (z-index 50, sopra modali interne ma sotto sheet
   full-screen come long-press). */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px);
  /* v53.22.15: brand-bg traslucido (era rgba(8,12,22,0.88)) */
  background: rgba(33, 0, 64, 0.92);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-top: 1px solid var(--brand-dark);
  z-index: 50;
  pointer-events: auto;
}
.bnav-tab {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  border: none;
  padding: 6px 4px;
  color: var(--brand-text);
  cursor: pointer;
  transition: color 0.15s, transform 0.1s;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bnav-tab svg {
  display: block;
}
.bnav-tab:active {
  transform: scale(0.94);
}
.bnav-tab.active {
  color: var(--brand-highlight);
}
.bnav-tab:hover:not(.active) {
  color: #a78bbf;
}
.bnav-label {
  letter-spacing: 0.06em;
}

/* ============== v20 · SCHERMATE GLOBALI (Nebula, Feed, Chat) ============== */
.app-screen {
  position: fixed;
  inset: 0;
  z-index: 30; /* sopra mappa/canvas (z<10), sotto modali (z>=100) */
  background: linear-gradient(180deg, #03030a 0%, #08081a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 70px; /* riserva spazio per bottom-nav */
}
.app-screen.hidden { display: none; }

/* Placeholder centrale "in arrivo" per schermate vuote */
.screen-placeholder {
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  padding: 24px;
  max-width: 320px;
}
.screen-placeholder-icon {
  font-size: 56px;
  margin-bottom: 14px;
  opacity: 0.85;
}
.screen-placeholder-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 8px;
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.04em;
}
.screen-placeholder-sub {
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.7;
  font-family: 'SF Mono', Menlo, monospace;
}

/* v53.20: per FEED e CHAT mantengo display:none (no transizione speciale).
   Per NEBULA uso opacity + transition per il fade-out coordinato. */
body.screen-feed #ui,
body.screen-chat #ui,
body.screen-feed #mapboxContainer,
body.screen-chat #mapboxContainer,
body.screen-feed #scene,
body.screen-chat #scene {
  display: none;
}

/* v53.20.1 / Sessione G: transizione MAPPA↔NEBULA con effetto "blast forward".
   Stile: ~750ms, opacity + scale combinati per dare la sensazione di volare
   attraverso/oltre la mappa fino alle stelle (e ritorno: atterrare sulla città).
   - Andata (mappa→nebula): la mappa cresce (scale 1→1.4) e svanisce (sembra
     di passarci dentro); le stelle arrivano da lontano (scale 1.25→1) e
     emergono. Effetto "warp avanti".
   - Ritorno (nebula→mappa): inverso. Stelle si allontanano (scale 1→1.25
     + opacity 0), mappa atterra (scale 1.15→1 + opacity 1).
   Bottom-bar e agenda restano fisse (z-index alto, no transform). */
#ui, #mapboxContainer, #scene,
#loopPageBtn, #extensionModeBadge, #tryLoopUpToggle,
#loopupProgressBanner, #inviteCounterBanner {
  transition: opacity 0.65s cubic-bezier(0.45, 0, 0.2, 1),
              transform 0.75s cubic-bezier(0.45, 0, 0.2, 1);
  transform-origin: center center;
}
body.screen-nebula #ui,
body.screen-nebula #mapboxContainer,
body.screen-nebula #scene,
body.screen-nebula #loopPageBtn,
body.screen-nebula #extensionModeBadge,
body.screen-nebula #tryLoopUpToggle,
body.screen-nebula #loopupProgressBanner,
body.screen-nebula #inviteCounterBanner {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.4); /* la mappa "ingrandisce e ti passa attraverso" */
}
/* v53.21.1: FIX click-through. La regola globale `#ui > * { pointer-events: auto }`
   sovrascrive `pointer-events:none` su #ui, lasciando topbar/filtri/modeSwitcher
   cliccabili anche in nebula → click sui cluster e bottoni della MAPPA. */
body.screen-nebula #ui > *,
body.screen-nebula #ui .hole-loop-mini,
body.screen-nebula #ui .hole-loops-overflow {
  pointer-events: none !important;
}

/* Canvas stelle nebula: fullscreen dietro tutto il contenuto della schermata.
   Effetto warp: parte da scale(1.25) (stelle lontane) e arriva a scale(1)
   (allineate al viewport) → sensazione di "avvicinarti alle stelle". */
#screenNebula {
  position: fixed; inset: 0;
  background: #050816; /* nero spazio profondo */
  z-index: 1;
  transition: opacity 0.65s cubic-bezier(0.45, 0, 0.2, 1),
              transform 0.75s cubic-bezier(0.45, 0, 0.2, 1);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.25); /* stato iniziale: stelle lontane, fuori focus */
  transform-origin: center center;
}
#screenNebula.hidden { display: none; opacity: 0; }
body.screen-nebula #screenNebula {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
.nebula-star-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  display: block;
  /* v53.22 / STEP 4: disabilita pinch-to-zoom default del browser su mobile,
     così il nostro handler può intercettare le 2 dita. */
  touch-action: none;
}

/* v53.22.9 / STEP 6: Feed Instagram-like.
   Stessa transizione fade+warp di nebula↔mappa per coerenza. */
#screenFeed {
  position: fixed; inset: 0;
  /* v53.22.15: sfondo schermata feed = brand-bg */
  background: var(--brand-bg);
  z-index: 1;
  transition: opacity 0.65s cubic-bezier(0.45, 0, 0.2, 1),
              transform 0.75s cubic-bezier(0.45, 0, 0.2, 1);
  opacity: 0;
  pointer-events: none;
  transform: scale(1.06);
  transform-origin: center center;
  overflow: hidden;
  display: flex; flex-direction: column;
}
#screenFeed.hidden { display: none; opacity: 0; }
body.screen-feed #screenFeed {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
body.screen-feed #ui,
body.screen-feed #mapboxContainer,
body.screen-feed #scene,
body.screen-feed #loopPageBtn,
body.screen-feed #extensionModeBadge,
body.screen-feed #tryLoopUpToggle,
body.screen-feed #loopupProgressBanner,
body.screen-feed #inviteCounterBanner {
  opacity: 0;
  pointer-events: none;
  transform: scale(1.4);
}
body.screen-feed #ui > *,
body.screen-feed #ui .hole-loop-mini,
body.screen-feed #ui .hole-loops-overflow {
  pointer-events: none !important;
}
body.screen-feed #screenNebula { opacity: 0; pointer-events: none; }

.feed-search-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 64px;
  right: 64px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  padding: 0 14px;
  /* v53.22.15: search bar feed su brand-dark */
  background: var(--brand-dark);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--brand-highlight);
  border-radius: 19px;
  color: var(--brand-text);
  font-size: 14px;
  cursor: pointer;
  z-index: 10;
  -webkit-tap-highlight-color: transparent;
}
.feed-search-btn:active { background: var(--brand-bg); }
/* v53.22.10: + feed = stesso gradient arancione del + della mappa */
.feed-create-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 14px;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #f97316);
  border: 0;
  color: #1a0a00;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(251, 146, 60, 0.45);
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
}
.feed-create-btn:active { transform: scale(0.92); }

.feed-scroll {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 62px);
  left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  padding: 0 0 100px;
  -webkit-overflow-scrolling: touch;
}
.feed-card {
  /* v53.22.15: card feed su brand-dark */
  background: var(--brand-dark);
  border-bottom: 1px solid var(--brand-bg);
  padding: 12px 0 14px;
  margin-bottom: 4px;
}
.fc-header {
  display: flex;
  align-items: center;
  padding: 0 14px 10px;
  gap: 10px;
}
.fc-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15);
  background: #475569;
  flex-shrink: 0;
}
.fc-author {
  flex: 1; min-width: 0;
}
.fc-author-name {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.fc-author-meta {
  font-size: 11.5px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}
.fc-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.fc-tag-loop { background: rgba(96,165,250,0.18); color: #93c5fd; }
.fc-tag-friend { background: rgba(167,139,250,0.18); color: #c4b5fd; }
.fc-tag-event-past { background: rgba(52,211,153,0.18); color: #6ee7b7; }
.fc-tag-event-future { background: rgba(252,211,77,0.20); color: #fcd34d; }
.fc-tag-ad { background: rgba(255,255,255,0.10); color: rgba(255,255,255,0.65); }

.fc-photo {
  width: 100%;
  aspect-ratio: 1.1;
  object-fit: cover;
  background: #1a1a2e;
  display: block;
}
.fc-body {
  padding: 10px 14px 2px;
}
.fc-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px 0;
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}
.fc-action {
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fc-action:active { color: #fff; }
.fc-caption {
  padding: 8px 14px 0;
  color: #fff;
  font-size: 13.5px;
  line-height: 1.4;
}
.fc-caption b { font-weight: 700; }
.fc-cta {
  margin: 10px 14px 0;
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  color: #1a0f00;
  border: 0;
  padding: 10px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  width: calc(100% - 28px);
  cursor: pointer;
}
.fc-cta-ghost {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
}
/* v53.22.10 / STEP 6.1: banner evento sorgente (tutti i post nascono da un evento) */
.fc-event-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 14px 0;
  padding: 9px 12px;
  background: rgba(96,165,250,0.10);
  border: 1px solid rgba(96,165,250,0.22);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  color: #93c5fd;
  -webkit-tap-highlight-color: transparent;
}
.fc-event-link:active { background: rgba(96,165,250,0.18); }
.fc-event-link-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(96,165,250,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.fc-event-link-text { flex: 1; min-width: 0; }
.fc-event-link-name {
  font-weight: 700;
  color: #fff;
  font-size: 12.5px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fc-event-link-meta {
  color: rgba(255,255,255,0.55);
  font-size: 11px;
  margin-top: 1px;
}
.fc-event-link-arrow {
  color: rgba(255,255,255,0.4);
  font-size: 14px;
  flex-shrink: 0;
}
/* v53.22 / STEP 4: pulsanti zoom (fallback per desktop/mouse) */
.nebula-zoom-controls {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
  right: 14px;
  display: flex; flex-direction: column;
  gap: 6px;
  z-index: 25;
}
.nebula-zoom-btn {
  width: 38px; height: 38px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.nebula-zoom-btn:active { transform: scale(0.92); }
.nebula-zoom-controls.hidden { display: none; }

/* v53.20.2 / Nebula STEP 1: bottone "+" → "NEW" (v53.22.9) top-right per creare loop */
.nebula-create-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: 14px;
  min-width: 52px; height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
  border: 0;
  color: #1a0f00;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4),
              0 0 0 1px rgba(255,255,255,0.15) inset;
  z-index: 30;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
}
.nebula-create-btn:active { transform: scale(0.92); }

/* v53.21 / Nebula STEP 3: tray top in linea tra agenda (left) e + (right).
   Contiene stella TU + miei altri loop. Tap TU = exit livello 2,
   tap loop = switch pivot a quel loop. */
.nebula-tray {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 60px;
  right: 60px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 22px;
  overflow-x: auto;
  overflow-y: hidden;
  z-index: 20;
  scrollbar-width: none;
}
.nebula-tray.hidden { display: none; }
.nebula-tray::-webkit-scrollbar { display: none; }
.ntt-item {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  background-color: rgba(0,0,0,0.4);
  background-size: cover;
  background-position: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.ntt-item:active { transform: scale(0.92); }
.ntt-tu {
  background: radial-gradient(circle at 50% 50%, rgba(252,211,77,0.35), rgba(245,158,11,0.05) 70%);
  border-color: #f59e0b;
  box-shadow: 0 0 0 1px rgba(245,158,11,0.5), 0 0 10px rgba(252,211,77,0.45);
}
.ntt-tu svg { display: block; }
.ntt-loop { border-color: rgba(255,255,255,0.2); }
/* v53.22.7 / STEP 5.3: loop selezionato nella tray = bordo + leggero scale */
.ntt-loop-active { transform: scale(1.12); z-index: 1; }
.ntt-loop-active:active { transform: scale(1.05); }

/* v53.22.4 / STEP 5: profilo LOOP stile Instagram (bottom sheet). */
.lpm-modal {
  padding: 0;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.lpm-header {
  position: relative;
  padding: 18px 16px 14px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.lpm-photo {
  width: 84px; height: 84px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.18);
  background: #475569;
  flex-shrink: 0;
}
.lpm-info { flex: 1; min-width: 0; }
.lpm-name {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  margin: 2px 0 6px;
}
.lpm-members {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  margin-bottom: 8px;
}
.lpm-description {
  font-size: 13px;
  line-height: 1.45;
  color: rgba(255,255,255,0.85);
  margin: 0;
}
.lpm-close, .ppm-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  z-index: 5;
  display: flex; align-items: center; justify-content: center;
}
/* v53.22.5 / STEP 5.1: strip membri (foto + nome) tra header e feed */
.lpm-members-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  scrollbar-width: none;
  flex-shrink: 0;
}
.lpm-members-strip::-webkit-scrollbar { display: none; }
.lpm-members-strip.hidden { display: none; }
.lpm-mli {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 60px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lpm-mli:active { transform: scale(0.94); }
.lpm-mli-photo {
  width: 52px; height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.22);
  background: #475569;
  display: block;
}
.lpm-mli.lpm-mli-bridge .lpm-mli-photo {
  border-color: #fcd34d;
  box-shadow: 0 0 8px rgba(252,211,77,0.5);
}
.lpm-mli-name {
  font-size: 11px;
  color: rgba(255,255,255,0.85);
  text-align: center;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.lpm-feed, .ppm-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  overflow-y: auto;
  padding: 2px 0 22px;
}
.lpm-feed img, .ppm-feed img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #1a1a2e;
  display: block;
}

/* Profilo PERSONA */
.ppm-modal {
  padding: 0;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ppm-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 18px 18px;
  gap: 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ppm-photo {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,255,255,0.2);
  background: #475569;
}
.ppm-name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin: 8px 0 2px;
}
.ppm-bio {
  font-size: 13px;
  color: rgba(255,255,255,0.75);
  margin: 0;
  line-height: 1.45;
  max-width: 320px;
}

/* Callout descrizione (per membri della cerchia) */
.callout-card {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  /* v53.22.14: sfondo callout → viola scuro #210040 (richiesta utente). */
  background: #210040;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  padding: 22px 20px 24px;
  width: min(84vw, 320px);
  color: #fff;
  text-align: center;
  z-index: 2;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.callout-photo {
  width: 76px; height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.22);
  background: #475569;
}
.callout-name {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  margin: 12px 0 6px;
}
.callout-bio {
  font-size: 13px;
  color: rgba(255,255,255,0.78);
  margin: 0;
  line-height: 1.45;
}

/* v53.21 / Nebula STEP 3: modal membri (tap su pivot al centro).
   Riusa pattern .modal-card (bottom sheet stile mappa). */
.nmm-modal {
  padding: 14px 16px 22px;
  max-height: 70vh;
  display: flex; flex-direction: column;
}
.nmm-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.nmm-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #fef3c7;
}
.nmm-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.nmm-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 10px;
  overflow-y: auto;
  padding: 4px 0;
}
.nmm-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  padding: 18px 0;
}
.nmm-person {
  display: flex; flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: #fff;
  -webkit-tap-highlight-color: transparent;
}
.nmm-person:active { transform: scale(0.96); }
.nmm-person-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.18);
  background: #475569;
}
.nmm-initials {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: #475569;
  color: #fff;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  border: 2px solid rgba(255,255,255,0.18);
}
.nmm-person-name {
  font-size: 11.5px;
  line-height: 1.2;
  text-align: center;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* L'AGENDA btn deve essere sempre visibile in ogni schermata.
   Soluzione: in screen ≠ map, mostro un agenda btn alternativo (HTML
   duplicato semplice) come floating top-left della screen attiva.
   Vedi .app-screen-topbar. */
.app-screen-agenda-btn {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 14px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.app-screen-agenda-btn:active { transform: scale(0.94); }

/* ============================================================
   EVENT INFO SHEET (long-press card) — LIGHT LIQUID GLASS
   ============================================================
   In tema mappa, lo sheet "info evento" assume estetica light+glass per
   distinguersi dalla card dark e dare un'aria "premium / dettaglio".
   ============================================================ */

/* === v13: Event info modal — morph from card circle to full-screen === */
body.theme-map #eventInfoSheet.event-info-modal {
  position: fixed;
  inset: 0;
  display: block;             /* no flex: il card è full-screen */
  z-index: 300;
  pointer-events: none;       /* attivo solo quando .open */
}
body.theme-map #eventInfoSheet.event-info-modal.open {
  pointer-events: auto;
}
body.theme-map #eventInfoSheet.event-info-modal.hidden {
  display: none;
}

body.theme-map #eventInfoSheet.event-info-modal {
  /* Garantisce copertura totale dello schermo, incluso safe-area iPhone
     e l'area sotto la URL bar Safari dinamica. */
  height: 100%;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
}
body.theme-map #eventInfoSheet .event-info-card {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  /* Background liquid-glass scuro come l'immagine evento, ma morbido */
  background: linear-gradient(180deg, #0f1320 0%, #1a1e2c 100%);
  color: #ececf2;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  border-radius: 0;
  overflow: hidden;
  /* Animazione clip-path circle: parte da un punto piccolo (cerchio card)
     e si espande fino a coprire lo schermo intero. Le coordinate del
     centro sono settate inline da JS (--ei-origin-x/y, --ei-origin-r). */
  clip-path: circle(var(--ei-origin-r, 0px) at var(--ei-origin-x, 50%) var(--ei-origin-y, 50%));
  transition: clip-path 0.42s cubic-bezier(0.22, 0.8, 0.28, 1);
}
body.theme-map #eventInfoSheet.open .event-info-card {
  clip-path: circle(150% at var(--ei-origin-x, 50%) var(--ei-origin-y, 50%));
}

/* Bottone X chiudi in alto a destra (sopra tutto) */
body.theme-map .ei-close-x {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: #fff;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s, transform 0.1s;
  font-family: 'SF Mono', Menlo, monospace;
}
body.theme-map .ei-close-x:hover { background: rgba(255, 255, 255, 0.22); }
body.theme-map .ei-close-x:active { transform: scale(0.92); }

/* Area scrollabile centrale (tutto il content tranne il footer) */
body.theme-map .ei-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 18px 16px;
  -webkit-overflow-scrolling: touch;
}

/* Wrapper foto evento (top della card) */
body.theme-map .ei-photo-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 20px;
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 16px;
  background: #0a0a14;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
body.theme-map .ei-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
body.theme-map .ei-source-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(15, 19, 32, 0.85);
  color: #fff;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Titolo */
body.theme-map .ei-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  margin: 0 0 14px;
  word-break: break-word;
}

/* Meta info */
body.theme-map .ei-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}
body.theme-map .ei-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}
body.theme-map .ei-meta-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}
body.theme-map .ei-meta-val {
  flex: 1;
  word-break: break-word;
}

/* Tags */
body.theme-map .ei-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
body.theme-map .ei-tag {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 10px;
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.04em;
}

/* Sezioni: descrizione, accettati, pending, ecc. */
body.theme-map .ei-section-block {
  margin-bottom: 18px;
}
body.theme-map .ei-section-label {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 8px;
}
body.theme-map .ei-section-title {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
body.theme-map .ei-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
body.theme-map .ei-description {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.85);
  /* Max altezza con scroll interno (la descrizione è scrollabile dentro
     il proprio block, oltre allo scroll generale .ei-scroll). */
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

/* People list (chip persone) */
body.theme-map .ei-people-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px;
  min-height: 50px;
}
body.theme-map .ei-empty {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  font-style: italic;
}
body.theme-map .ei-person-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
}
body.theme-map .ei-person-photo {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid transparent;
}
body.theme-map .ei-person-chip.s-confirmed .ei-person-photo { border-color: #22c55e; }
body.theme-map .ei-person-chip.s-pending .ei-person-photo { border-color: #facc15; }
body.theme-map .ei-person-chip.s-declined .ei-person-photo { border-color: #f87171; }
body.theme-map .ei-person-chip.s-declined .ei-person-name { text-decoration: line-through; opacity: 0.6; }
body.theme-map .ei-person-loop-tag {
  /* v28: stesso font system della UI (non monospace), pillola colorata
     dal loop con border + bg leggero. Visibile sia in event detail
     che in event info sheet. */
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
  margin-left: 4px;
}

/* Recensioni TripAdvisor (propose-only) */
body.theme-map .ei-reviews {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
body.theme-map .ei-review {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}
body.theme-map .ei-review-stars {
  font-size: 13px;
  color: #facc15;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
body.theme-map .ei-review-author {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 6px;
}
body.theme-map .ei-review-text {
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.8);
}

/* Footer con bottoni azione (fisso in fondo) */
body.theme-map .ei-footer {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: linear-gradient(180deg,
    rgba(15, 19, 32, 0) 0%,
    rgba(15, 19, 32, 0.96) 30%);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
body.theme-map .ei-see-others-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 12px 16px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s, transform 0.1s;
}
body.theme-map .ei-see-others-btn:hover { background: rgba(255, 255, 255, 0.10); }
body.theme-map .ei-see-others-btn:active { transform: scale(0.98); }
body.theme-map .ei-see-others-btn.hidden { display: none; }
body.theme-map .ei-alien {
  font-size: 16px;
  filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.5));
}
body.theme-map .ei-back-btn {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #001a1f;
  border: none;
  border-radius: 999px;
  padding: 14px 18px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
  transition: transform 0.1s;
}
body.theme-map .ei-back-btn:active { transform: scale(0.98); }
/* v53.12: il bottone "torna/vai" deriva il colore dal tipo evento (non dal
   currentMode). Vedi populateEventInfoSheet — assegna esattamente una classe
   tra: ei-back-cyan (invito/partecipo), ei-back-amber (mio evento/proposta),
   ei-back-purple (stranger), ei-back-red (rifiutato).
   Le regole vecchie body.mode-propose sono override per retro-compat. */
body.theme-map .ei-back-btn.ei-back-cyan {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #001a1f;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.4);
}
body.theme-map .ei-back-btn.ei-back-amber {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #1a0a00;
  box-shadow: 0 4px 16px rgba(251, 146, 60, 0.4);
}
body.theme-map .ei-back-btn.ei-back-purple {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  color: #f0eaff;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}
body.theme-map .ei-back-btn.ei-back-red {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
}
/* Fallback legacy se nessuna classe viene assegnata (non dovrebbe succedere) */
body.theme-map .ei-back-btn:not(.ei-back-cyan):not(.ei-back-amber):not(.ei-back-purple):not(.ei-back-red) {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #001a1f;
}
body.mode-propose .ei-back-btn:not(.ei-back-cyan):not(.ei-back-amber):not(.ei-back-purple):not(.ei-back-red) {
  background: linear-gradient(135deg, #fb923c, #f97316);
  color: #1a0a00;
}

/* Mostra solo le sezioni invite o propose in base alla modalità */
body:not(.mode-invite) .ei-invite-only { display: none; }
body:not(.mode-propose) .ei-propose-only { display: none; }
body.mode-propose .ei-invite-only { display: none; }
body.mode-invite .ei-propose-only { display: none; }

/* v13: regole legacy tema light RIMOSSE.
   Il modal eventInfoSheet ora usa tema dark (definito sopra). */

/* ============================================================
 * v53.0 · CONTROLLO ESTENSIONE INVITO (crea-evento + modifica-evento)
 * Radio: closed / limited / open + slider +N (1..3, solo se limited)
 * ============================================================ */
.create-extension-block .ce-extension-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ce-ext-radio {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.15s;
}
.ce-ext-radio:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
.ce-ext-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ce-ext-track {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.30);
  margin-top: 2px;
  position: relative;
  transition: all 0.15s;
}
.ce-ext-radio input[type="radio"]:checked + .ce-ext-track {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.20);
}
.ce-ext-radio input[type="radio"]:checked + .ce-ext-track::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}
.ce-ext-radio input[type="radio"]:checked ~ .ce-ext-text .ce-ext-title {
  color: #fff;
}
.ce-ext-radio:has(input:checked) {
  background: rgba(74, 222, 128, 0.08);
  border-color: rgba(74, 222, 128, 0.35);
}
.ce-ext-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.ce-ext-title {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  letter-spacing: 0.01em;
}
.ce-ext-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.4;
}
/* Slider +N (visibile sotto la radio 'limited' quando selezionata) */
.ce-ext-plus-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 4px 50px; /* indent sotto la radio limited */
  padding: 10px 14px;
  background: rgba(74, 222, 128, 0.06);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 10px;
}
.ce-ext-plus-slider.hidden { display: none; }
.ce-ext-plus-slider .qu-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.40);
  color: #86efac;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ce-ext-plus-slider .qu-btn:active { transform: scale(0.92); }
.ce-ext-plus-value {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  color: #4ade80;
  min-width: 36px;
  text-align: center;
}
.ce-ext-plus-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
}

/* Quando openToStrangers è disabilitato (extensionMode !== 'open'), il
   blocco intero è "spento" e c'è una nota esplicativa. */
.ce-block-locked {
  opacity: 0.55;
  pointer-events: none;
}
.ce-block-locked .stranger-toggle { cursor: not-allowed; }
.ce-strangers-locked-hint {
  font-size: 11px;
  color: rgba(250, 204, 21, 0.85);
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(250, 204, 21, 0.08);
  border-left: 2px solid rgba(250, 204, 21, 0.50);
  border-radius: 6px;
  font-style: italic;
  opacity: 1;
  pointer-events: auto;
}
.create-strangers-block.ce-block-locked .ce-strangers-locked-hint {
  opacity: 1;
}
.ce-strangers-locked-hint.hidden { display: none; }

/* v53.1: opzione radio bloccata (transizione vietata) */
.ce-ext-radio.ce-ext-locked {
  opacity: 0.40;
  cursor: not-allowed;
}
.ce-ext-radio.ce-ext-locked input { pointer-events: none; }
.ce-ext-radio.ce-ext-locked .ce-ext-track {
  border-style: dashed;
}
.ce-ext-lock-hint {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.50);
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 2px solid rgba(255, 255, 255, 0.20);
  border-radius: 6px;
  font-style: italic;
}
.ce-ext-lock-hint.hidden { display: none; }
.ce-ext-plus-slider .qu-btn:disabled {
  opacity: 0.40;
  cursor: not-allowed;
}

/* ============================================================
 * v53.0 · STORICO AGENDA (eventi passati + falliti)
 * Sezione separata in fondo alla lista, stile dimmer
 * ============================================================ */
.agenda-history-section {
  margin: 28px 16px 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}
.agenda-history-header {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 4px;
}
.agenda-history-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.40);
  font-style: italic;
  margin-bottom: 14px;
}
.agenda-history-card {
  padding: 11px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0.78;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.agenda-history-card:hover {
  opacity: 0.95;
  background: rgba(255, 255, 255, 0.05);
}
.agenda-history-card.h-failed {
  border-color: rgba(248, 113, 113, 0.30);
  background: rgba(248, 113, 113, 0.06);
}
.agenda-history-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.agenda-history-title {
  font-weight: 700;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
}
.agenda-history-time {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}
.agenda-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.50);
  font-family: 'SF Mono', Menlo, monospace;
  letter-spacing: 0.02em;
}
.agenda-history-tag {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  text-transform: lowercase;
}
.h-failed .agenda-history-tag {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.30);
  color: #fca5a5;
}
.agenda-history-date {
  opacity: 0.85;
}
.agenda-history-quorum {
  color: rgba(252, 165, 165, 0.85);
}

/* v53.1: sub-tabs storico (passati / non concretizzati) */
.agenda-history-subtabs {
  display: flex;
  gap: 6px;
  padding: 6px 16px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.agenda-history-subtabs.hidden { display: none; }
.hist-subtab {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.60);
  padding: 7px 10px;
  border-radius: 999px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s;
}
.hist-subtab.active {
  background: rgba(74, 222, 128, 0.14);
  border-color: rgba(74, 222, 128, 0.40);
  color: #86efac;
}
.hist-subtab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.85);
}

/* v53.1: search input nello storico */
.agenda-history-search-wrap {
  padding: 12px 16px 6px;
}
.agenda-history-search {
  width: 100%;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  color: #fff;
  font-size: 12.5px;
  font-family: inherit;
  outline: none;
}
.agenda-history-search:focus {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(255, 255, 255, 0.07);
}
.agenda-history-search::placeholder {
  color: rgba(255, 255, 255, 0.40);
}

/* v53.1: storico card "passato" → mostra anche partecipanti */
.agenda-history-card.h-past {
  border-color: rgba(74, 222, 128, 0.20);
  background: rgba(74, 222, 128, 0.04);
}
.h-past .agenda-history-tag {
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.30);
  color: #86efac;
}
.agenda-history-participants {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hist-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hist-group-label {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.hist-group-strangers { color: #c4b5fd; }
.hist-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.hist-chip {
  font-size: 10.5px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.85);
  font-family: 'SF Mono', Menlo, monospace;
}
.hist-chip-stranger {
  background: rgba(167, 139, 250, 0.10);
  border-color: rgba(167, 139, 250, 0.30);
  color: #c4b5fd;
}
.hist-chip-match {
  background: rgba(250, 204, 21, 0.18);
  border-color: rgba(250, 204, 21, 0.50);
  color: #fde68a;
  font-weight: 700;
}

/* ============================================================
 * v53.3 / Fase 2 Step 2.1 · BADGE "evento privato" / "+N"
 * v53.4: spostato SOPRA la card per non coprire eventuali pianeti
 * placeholder ospite orbitanti. Palette CYAN uniforme (coerente con
 * tema INVITE).
 * ============================================================ */
.extension-mode-badge {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* v53.18.4: posizionato sopra #bottomActions (tray + bottoni accetta/rifiuta).
     Il valore esatto di `bottom` viene settato in JS via updateExtensionModeBadge
     in base alle dimensioni reali di #bottomActions. Fallback 220px se assente. */
  top: auto;
  bottom: 220px;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.95), rgba(8, 145, 178, 0.85));
  border: 1px solid rgba(103, 232, 249, 0.50);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.30);
  font-family: 'SF Mono', Menlo, monospace;
  pointer-events: none;
  animation: emb-in 0.25s ease-out;
  max-width: calc(100vw - 32px);
}
.extension-mode-badge.hidden { display: none; }
@keyframes emb-in {
  0% { opacity: 0; transform: translate(-50%, -8px); }
  100% { opacity: 1; transform: translate(-50%, 0); }
}
.emb-icon { font-size: 13px; line-height: 1; }
.emb-text {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ecfeff;
}
/* v53.4 / Step D: trail propagazione visualizzato sotto il badge principale */
.emb-trail {
  display: block;
  width: 100%;
  font-size: 9.5px;
  color: rgba(236, 254, 255, 0.85);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-top: 3px;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  text-align: center;
}
.emb-trail b { font-weight: 700; }
/* Quando il badge ha il trail, è multi-line: aggiusta layout */
.extension-mode-badge:has(.emb-trail) {
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 7px 16px 8px;
  text-align: center;
}
.extension-mode-badge:has(.emb-trail) .emb-icon,
.extension-mode-badge:has(.emb-trail) .emb-text {
  display: inline-block;
  margin: 0 4px;
}

/* ============================================================
 * v53.4 / Fase 2 Step B · MODAL ricerca ospite +N
 * ============================================================ */
.gsm-search-wrap { padding: 0 18px 12px; }
.gsm-search-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.gsm-search-input:focus {
  border-color: rgba(103, 232, 249, 0.50);
  background: rgba(255, 255, 255, 0.08);
}
.gsm-results {
  max-height: 280px;
  overflow-y: auto;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gsm-empty {
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  text-align: center;
  padding: 20px 0;
  font-style: italic;
}
.gsm-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
  color: inherit;
  font-family: inherit;
}
.gsm-result:hover {
  background: rgba(103, 232, 249, 0.10);
  border-color: rgba(103, 232, 249, 0.30);
}
.gsm-result-photo {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.gsm-result-info { flex: 1; min-width: 0; }
.gsm-result-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}
.gsm-result-handle {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gsm-result-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gsm-result-badge.in-circle {
  background: rgba(74, 222, 128, 0.14);
  border: 1px solid rgba(74, 222, 128, 0.30);
  color: #86efac;
}
.gsm-result-badge.out-circle {
  background: rgba(167, 139, 250, 0.14);
  border: 1px solid rgba(167, 139, 250, 0.30);
  color: #c4b5fd;
}
/* v53.10: risultato già scelto come ospite — disabled */
.gsm-result.gsm-result-chosen {
  opacity: 0.50;
  cursor: not-allowed;
  pointer-events: none;
}
.gsm-result-badge.chosen-badge {
  background: rgba(74, 222, 128, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.40);
  color: #86efac;
}
.gsm-link-row {
  padding: 10px 18px 4px;
}
.gsm-link-btn {
  width: 100%;
  padding: 10px 12px;
  background: rgba(167, 139, 250, 0.10);
  border: 1px dashed rgba(167, 139, 250, 0.40);
  color: #d8c4ff;
  border-radius: 12px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* v53.4: chip ospite nel tray (stile cyan tratteggiato) */
.dropped-chip.dropped-chip-guest {
  border-style: dashed !important;
}
.dropped-chip-guest-tag {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.40);
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}

/* v53.4 / Fase 2 Step C: sezione "i tuoi ospiti +N" in event detail */
.edp1-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.edp1-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}
.edp1-chip-empty {
  border-style: dashed;
  background: rgba(34, 211, 238, 0.06);
  border-color: rgba(34, 211, 238, 0.30);
}
.edp1-chip-empty:hover {
  background: rgba(34, 211, 238, 0.10);
}
.edp1-empty-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.12);
  border: 1px dashed rgba(34, 211, 238, 0.40);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #67e8f9;
  font-weight: 700;
  flex-shrink: 0;
}
.edp1-photo {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(34, 211, 238, 0.40);
  flex-shrink: 0;
}
.edp1-info { flex: 1; min-width: 0; }
.edp1-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}
.edp1-status {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
}
.edp1-remove {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.30);
  color: #f87171;
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
}

/* v53.4 / Step F: modal QR/link */
.glm-qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
}
.glm-qr-img {
  /* v53.9: QR reale generato via api.qrserver.com (stesso provider di qrImage
     usato nel modal "invita all'evento" dell'organizzatore). */
  width: 140px; height: 140px;
  border-radius: 14px;
  background: #fff;
  padding: 8px;
  object-fit: contain;
}

/* v53.10: placeholder generic per ospiti viaLink (non LoopUp) */
.selected-person-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(34, 211, 238, 0.18);
  border: 1.5px dashed rgba(103, 232, 249, 0.55);
  color: #67e8f9;
  font-size: 12px;
  line-height: 1;
}
.edp1-photo-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(34, 211, 238, 0.14);
  border: 2px dashed rgba(103, 232, 249, 0.50);
  color: #67e8f9;
  font-size: 18px;
}
/* Tray chip viaLink — niente background image, mostra '👤' come placeholder
   tramite ::before (l'orb-bg è stato resettato a 'none' in JS). */
.dropped-chip-external::before {
  content: '👤';
  font-size: 11px;
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.18);
  border: 1.5px dashed rgba(103, 232, 249, 0.55);
}
.glm-qr-hint {
  margin-top: 10px;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.04em;
}
.glm-link-row {
  display: flex;
  gap: 8px;
  padding: 10px 18px;
}
.glm-link-row input {
  flex: 1;
  padding: 9px 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-family: 'SF Mono', Menlo, monospace;
}
.glm-actions {
  display: flex;
  gap: 8px;
  padding: 10px 18px 16px;
}
.glm-actions button {
  flex: 1;
}
/* v53.8: input nome ospite nel modal link */
.glm-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 18px 0;
}
.glm-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  font-family: 'SF Mono', Menlo, monospace;
}
#glmNameInput {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
#glmNameInput:focus {
  border-color: rgba(103, 232, 249, 0.50);
  background: rgba(255, 255, 255, 0.08);
}
#glmNameInput::placeholder {
  color: rgba(255, 255, 255, 0.40);
}

/* ============== v53.15 / M-base CHAT SKELETON (§13.10) ============== */
#screenChat { background: linear-gradient(180deg, #05050d 0%, #02020a 100%); }
.chat-list-view { display: flex; flex-direction: column; height: 100%; }
.chat-list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.chat-list-title { color: #fff; font-size: 22px; font-weight: 700; margin: 0; }
.chat-list { flex: 1; overflow-y: auto; padding: 6px 0 80px; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; transition: background 0.15s;
}
.chat-item:hover, .chat-item:active { background: rgba(255,255,255,0.04); }
.chat-item-photo {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.12);
}
.chat-item-photo.loopy {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  display: flex; align-items: center; justify-content: center;
  border-color: rgba(167,139,250,0.5);
  color: #fff;
  padding: 6px;
  overflow: hidden;
}
.chat-item-photo.loopy svg { width: 100%; height: 100%; color: #fff; }
.chat-item-info { flex: 1; min-width: 0; }
.chat-item-row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-item-name { color: #fff; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item-time { color: rgba(255,255,255,0.4); font-size: 12px; flex-shrink: 0; }
.chat-item-last {
  color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-item-badge {
  background: #22d3ee; color: #02020a; font-weight: 700; font-size: 11px;
  padding: 2px 7px; border-radius: 10px; margin-left: 8px;
}
.chat-item-badge.pinned { background: #fbbf24; }
.chat-item.loopy-row .chat-item-name { color: #c4b5fd; }
.chat-item.has-pinned-poll {
  background: rgba(34,211,238,0.04);
  border-left: 3px solid #22d3ee;
  padding-left: 15px;
}

/* CHAT VIEW (singola chat) */
.chat-view {
  position: fixed; inset: 0; z-index: 60;
  background: linear-gradient(180deg, #05050d 0%, #02020a 100%);
  display: flex; flex-direction: column;
  animation: chatViewIn 0.25s cubic-bezier(.2,.8,.2,1);
}
@keyframes chatViewIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.chat-view-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: rgba(5,5,13,0.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky; top: 0; z-index: 2;
}
.chat-back-btn {
  background: transparent; border: none; color: #22d3ee;
  font-size: 28px; font-weight: 300; cursor: pointer; padding: 0 4px;
  line-height: 1;
}
.chat-view-photo { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.12); }
.chat-view-photo.loopy-bg {
  background: linear-gradient(135deg, #22d3ee, #a78bfa);
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  border-color: rgba(167,139,250,0.5);
}
.chat-view-info { flex: 1; }
.chat-view-name { color: #fff; font-weight: 600; font-size: 15px; }
.chat-view-sub { color: rgba(255,255,255,0.5); font-size: 12px; margin-top: 1px; }
.chat-view-pinned {
  background: rgba(34,211,238,0.06);
  border-bottom: 1px solid rgba(34,211,238,0.18);
  padding: 12px 14px;
}
.chat-view-pinned.hidden { display: none; }
.chat-view-messages {
  flex: 1; overflow-y: auto;
  padding: 12px 14px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-msg {
  max-width: 78%; padding: 8px 12px; border-radius: 14px;
  color: #fff; font-size: 14px; line-height: 1.35;
  word-wrap: break-word;
}
.chat-msg.them {
  background: rgba(255,255,255,0.08);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-msg.me {
  background: rgba(34,211,238,0.25);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-msg.loopy {
  background: linear-gradient(135deg, rgba(34,211,238,0.12), rgba(167,139,250,0.12));
  border: 1px solid rgba(167,139,250,0.3);
  align-self: center; max-width: 92%;
  font-size: 13px; color: rgba(255,255,255,0.85); font-style: italic;
}
.chat-msg-author {
  font-size: 11px; color: #94a3b8; margin-bottom: 3px; font-weight: 600;
}
.chat-msg-time { font-size: 10px; color: rgba(255,255,255,0.4); margin-top: 3px; text-align: right; }
.chat-view-input {
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 12px);
  background: rgba(5,5,13,0.95);
  border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 4px;
}
.chat-view-input input {
  background: rgba(255,255,255,0.06); color: #fff; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px; padding: 10px 16px; font-size: 14px;
}
.chat-view-input input::placeholder { color: rgba(255,255,255,0.4); }
.chat-view-input input:disabled { opacity: 0.55; cursor: not-allowed; }
.chat-input-hint { color: rgba(255,255,255,0.4); font-size: 11px; text-align: center; }

/* PINNED-POLL (voto loop counter §13.10.8 + sondaggio post-evento §13.11) */
.pinned-poll {
  background: linear-gradient(180deg, rgba(34,211,238,0.08), rgba(34,211,238,0.02));
  border: 1px solid rgba(34,211,238,0.25);
  border-radius: 10px;
  padding: 12px 14px;
}
.pinned-poll-header {
  display: flex; align-items: center; gap: 6px;
  color: #67e8f9; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.pinned-poll-title { color: #fff; font-weight: 600; font-size: 14px; line-height: 1.3; margin-bottom: 8px; }
.pinned-poll-quorum {
  background: rgba(34,211,238,0.12); color: #67e8f9;
  padding: 4px 10px; border-radius: 12px;
  display: inline-block; font-size: 12px; font-weight: 600; margin-bottom: 10px;
}
.pinned-poll-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pinned-poll-actions button {
  flex: 1; min-width: 70px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04); color: #fff;
  font-size: 13px; cursor: pointer; transition: all 0.15s;
}
.pinned-poll-actions button:hover { background: rgba(255,255,255,0.08); }
.pinned-poll-actions button.vote-active { background: rgba(34,211,238,0.25); border-color: #22d3ee; color: #67e8f9; font-weight: 600; }
.pinned-poll-actions button.vote-no.vote-active { background: rgba(248,113,113,0.2); border-color: #f87171; color: #fca5a5; }
.pinned-poll-meta { color: rgba(255,255,255,0.5); font-size: 11px; margin-top: 8px; text-align: center; }
.pinned-poll.status-quorum-reached { border-color: rgba(34,197,94,0.4); background: linear-gradient(180deg, rgba(34,197,94,0.06), rgba(34,197,94,0.02)); }
.pinned-poll.status-approved { border-color: rgba(34,197,94,0.6); }
.pinned-poll.status-rejected,
.pinned-poll.status-expired,
.pinned-poll.status-cancelled,
.pinned-poll.status-must-have-failed {
  border-color: rgba(255,255,255,0.1); opacity: 0.7;
}
.pinned-poll-quorum-controls {
  display: flex; gap: 4px; align-items: center; margin-top: 6px;
}
.pinned-poll-quorum-controls button {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px;
}
.pinned-poll-quorum-controls button:disabled { opacity: 0.3; cursor: not-allowed; }
.pinned-poll-edit-hint { font-size: 10px; color: rgba(255,255,255,0.4); margin-left: 4px; }

/* v53.17.7: COLORE DEDICATO lime per Try to LoopUp pending (palette canonica)
   viola=sconosciuti, arancione=org, cyan=inviti, giallo=pending, rosso=rifiutati,
   verde=biglietti/calendario, lime=loopup pending */
.agenda-loopup-section {
  margin: 12px 14px 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(132,204,22,0.10), rgba(34,197,94,0.05));
  border: 1.5px solid rgba(132,204,22,0.35);
  border-radius: 12px;
}
.agenda-loopup-section-header {
  color: #bef264; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.agenda-event-card.state-loopup {
  background: rgba(132,204,22,0.08) !important;
  border-color: rgba(132,204,22,0.5) !important;
  border-left: 4px solid #84cc16 !important;
}
.agenda-event-card.state-loopup .agenda-event-time-top { color: #bef264 !important; }
.agenda-state-pill.state-pill-loopup {
  background: rgba(132,204,22,0.18) !important;
  color: #bef264 !important;
  border: 1px solid rgba(132,204,22,0.4) !important;
}
.agenda-event-loop-line {
  color: rgba(190,242,100,0.85); font-size: 12px; margin-top: 4px;
}
.agenda-event-where { color: rgba(255,255,255,0.55); font-size: 11px; margin-top: 3px; }

/* v53.17.4 round 2: sub-tab loopup → nascondi TUTTE le 4 row bottoni standard
   (actions-invite-open/rejected/new + actions-propose) + tray + extension badge.
   Sostituiti dal banner progress + actions dedicati. */
body.sub-loopup .actions-invite-open,
body.sub-loopup .actions-invite-rejected,
body.sub-loopup .actions-invite-new,
body.sub-loopup .actions-propose { display: none !important; }
body.sub-loopup #tray { display: none !important; }
body.sub-loopup .invited-by { display: none !important; }
body.sub-loopup .extension-mode-badge { display: none !important; }
body.sub-loopup #pageBtn { display: none !important; }

/* v53.17.3: banner "loopup in corso" visualizzato sull'invito quando è nella
   sub-tab loopup. Sopra al tray normale, sostituisce visualmente lo stato. */
.loopup-progress-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  left: 16px; right: 16px;
  background: rgba(8, 12, 22, 0.96);
  background-image: linear-gradient(135deg, rgba(34,211,238,0.18), rgba(167,139,250,0.15));
  border: 1.5px solid rgba(34,211,238,0.55);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 50;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(34,211,238,0.15);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: #fff;
  display: none;
  animation: slideUp 0.3s ease-out;
}
.loopup-progress-banner.visible { display: block; }
.loopup-progress-banner-title {
  font-weight: 700; color: #67e8f9; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.loopup-progress-banner-title svg { width: 14px; height: 14px; }
.loopup-progress-banner-body { font-size: 13px; line-height: 1.4; margin-bottom: 10px; }
.loopup-progress-banner-status {
  background: rgba(34,211,238,0.15); color: #67e8f9;
  padding: 4px 10px; border-radius: 12px; display: inline-block;
  font-size: 12px; font-weight: 600; margin-bottom: 8px;
}
.loopup-progress-banner-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.loopup-progress-banner-actions button {
  flex: 1; padding: 9px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid;
}
.lpb-go-chat { background: rgba(34,211,238,0.18); border-color: #22d3ee; color: #67e8f9; }
.lpb-cancel { background: rgba(248,113,113,0.15); border-color: #f87171; color: #fca5a5; }

/* v53.17.2: sub-tab "loopup in corso" (visibile solo se count > 0) */
.sub-tab-loopup { display: flex; align-items: center; gap: 4px; }
.sub-tab-loopup.hidden { display: none !important; }
.sub-tab-loopup-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: #22d3ee;
}
.sub-tab-loopup.active .sub-tab-loopup-icon { color: #fff; }

/* ============== v53.15 / E3b — TRY TO LOOPUP icon ============== */
/* v53.17: solo icona (no scritte), simbolo loop annodato. iOS-safe tap target. */
.try-loopup-toggle {
  position: fixed; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); left: 16px;
  width: 52px; height: 52px; padding: 0;
  background: rgba(10, 10, 22, 0.92);
  color: #94a3b8; /* spento: grigio */
  border: 2px solid rgba(148, 163, 184, 0.6);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  cursor: pointer; z-index: 65; /* sopra tutto eccetto modal-toplevel */
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  -webkit-tap-highlight-color: rgba(34, 211, 238, 0.3);
  touch-action: manipulation;
  user-select: none;
}
.try-loopup-toggle:hover, .try-loopup-toggle:active { transform: scale(1.08); }
.try-loopup-toggle.active {
  color: #22d3ee;
  border-color: #22d3ee;
  box-shadow: 0 0 22px rgba(34,211,238,0.7), 0 4px 14px rgba(0,0,0,0.5);
  background: rgba(34, 211, 238, 0.12);
  animation: tluPulse 2s ease-in-out infinite;
}
@keyframes tluPulse {
  0%, 100% { box-shadow: 0 0 22px rgba(34,211,238,0.7), 0 4px 14px rgba(0,0,0,0.5); }
  50% { box-shadow: 0 0 30px rgba(34,211,238,1), 0 4px 14px rgba(0,0,0,0.5); }
}
.try-loopup-toggle.hidden { display: none; }
.try-loopup-toggle svg { display: block; width: 26px; height: 26px; pointer-events: none; }

/* v53.18 / E5.4: tooltip onboarding sopra il toggle, una sola volta */
.tlu-onboarding-tip {
  position: fixed;
  right: 14px;
  bottom: 130px;
  max-width: 260px;
  background: linear-gradient(135deg, rgba(34,211,238,0.96), rgba(167,139,250,0.92));
  color: #fff;
  padding: 12px 36px 12px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45), 0 0 18px rgba(34,211,238,0.45);
  font-size: 13px;
  line-height: 1.35;
  z-index: 70;
  animation: tluOnbBounce 0.4s ease-out, tluOnbWiggle 2.2s ease-in-out 0.4s infinite;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.tlu-onboarding-tip.hidden { display: none; }
.tlu-onb-body strong { font-size: 13px; }
.tlu-onb-body span { font-size: 12px; opacity: 0.92; }
.tlu-onb-arrow {
  position: absolute;
  bottom: -8px;
  right: 22px;
  width: 16px; height: 16px;
  background: rgba(167,139,250,0.92);
  transform: rotate(45deg);
  box-shadow: 4px 4px 8px rgba(0,0,0,0.2);
}
.tlu-onb-close {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
}
.tlu-onb-close:active { background: rgba(255,255,255,0.18); }
@keyframes tluOnbBounce {
  0% { opacity: 0; transform: translateY(8px) scale(0.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes tluOnbWiggle {
  0%, 100% { transform: translateY(0) rotate(0); }
  35% { transform: translateY(-3px) rotate(-1deg); }
  65% { transform: translateY(2px) rotate(1deg); }
}

/* v53.17: stili modal counter (mancavano cp-loop-item) */
.cp-loop-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 6px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  width: 100%;
  color: #fff;
  text-align: left;
  transition: all 0.15s;
  -webkit-tap-highlight-color: rgba(34,211,238,0.2);
  touch-action: manipulation;
}
.cp-loop-item:active { transform: scale(0.98); }
.cp-loop-item.selected {
  background: rgba(34,211,238,0.15);
  border-color: #22d3ee;
  box-shadow: 0 0 12px rgba(34,211,238,0.3);
}
.cp-loop-photo { width: 38px; height: 38px; border-radius: 50%; border: 2px solid; flex-shrink: 0; }
.cp-loop-info { flex: 1; min-width: 0; }
.cp-loop-name { font-weight: 600; font-size: 14px; color: #fff; }
.cp-loop-sub { font-size: 12px; color: rgba(255,255,255,0.55); margin-top: 2px; }

/* v53.18 / E5.1: picker irrinunciabili counter */
#cpMustHavePicker {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.06);
}
.cp-mh-hint {
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
  line-height: 1.35;
  margin-bottom: 10px;
}
.cp-mh-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  max-height: 30vh;
  overflow-y: auto;
  padding: 2px;
}
.cp-mh-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 14px 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  font-style: italic;
}
.cp-mh-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 6px;
  background: rgba(255,255,255,0.03);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: rgba(34,211,238,0.18);
  touch-action: manipulation;
}
.cp-mh-item:active { transform: scale(0.96); }
.cp-mh-item.selected {
  background: rgba(34,211,238,0.18);
  border-color: #22d3ee;
  box-shadow: 0 0 10px rgba(34,211,238,0.3);
}
.cp-mh-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.cp-mh-photo {
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
  object-fit: cover;
}
.cp-mh-item.selected .cp-mh-photo { border-color: #22d3ee; }
.cp-mh-name {
  font-size: 11px;
  color: #fff;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cp-mh-counter {
  margin-top: 8px;
  text-align: right;
  font-size: 11px;
  color: rgba(255,255,255,0.55);
}

/* v53.17: hint Loopy chat (non interattiva) */
.chat-loopy-hint {
  background: linear-gradient(135deg, rgba(34,211,238,0.06), rgba(167,139,250,0.06));
  border: 1px dashed rgba(167,139,250,0.3);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 14px 12px;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  font-style: italic;
  text-align: center;
}

/* ============== v53.15 / E3d — Counter approval section in agenda ============== */
.counter-requests-section { margin: 14px 0; }
.counter-requests-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; color: #67e8f9; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 0 18px 8px;
}
.counter-request-card {
  background: rgba(34,211,238,0.06); border: 1px solid rgba(34,211,238,0.25);
  border-radius: 12px; padding: 12px; margin: 0 14px 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.crc-header { display: flex; align-items: center; gap: 10px; }
.crc-photo { width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(34,211,238,0.5); }
.crc-name { font-weight: 600; color: #fff; font-size: 14px; }
.crc-sub { font-size: 12px; color: rgba(255,255,255,0.6); }
.crc-actions { display: flex; gap: 6px; margin-top: 4px; }
.crc-btn { flex: 1; padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; border: 1px solid; }
.crc-btn.accept { background: rgba(34,197,94,0.15); border-color: #22c55e; color: #86efac; }
.crc-btn.reject { background: rgba(248,113,113,0.15); border-color: #f87171; color: #fca5a5; }

/* v53.17.8 — Banner invito ricevuto via counter (sezione INVITI). Solido + posizione base. */
.invite-counter-banner {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 90px);
  left: 16px; right: 16px;
  background: rgba(8, 12, 22, 0.96);
  background-image: linear-gradient(135deg, rgba(34,211,238,0.18), rgba(167,139,250,0.15));
  border: 1.5px solid rgba(34,211,238,0.55);
  border-radius: 14px;
  padding: 14px 16px;
  z-index: 50;
  box-shadow: 0 8px 28px rgba(0,0,0,0.6), 0 0 0 1px rgba(34,211,238,0.15);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  color: #fff;
  font-size: 13px;
  display: none;
  animation: slideUp 0.3s ease-out;
}

/* v53.17.8: quando invito è via counter, nascondi i bottoni accept/reject standard +
   il tray + invitato-da-box (la decisione è via voto, non via questi bottoni) */
body.invite-via-counter .actions-invite-open,
body.invite-via-counter .actions-invite-rejected,
body.invite-via-counter .actions-invite-new,
body.invite-via-counter .actions-propose,
body.invite-via-counter #tray,
body.invite-via-counter .invited-by,
body.invite-via-counter .extension-mode-badge,
body.invite-via-counter #pageBtn { display: none !important; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.invite-counter-banner.visible { display: block; }
.invite-counter-banner.hidden { display: none !important; }
.invite-counter-banner-title { font-weight: 700; color: #67e8f9; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }
.invite-counter-banner-body { margin-bottom: 8px; line-height: 1.4; }
.invite-counter-banner-actions { display: flex; gap: 6px; }
.invite-counter-banner-actions button {
  flex: 1; padding: 7px 10px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.05); color: #fff;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.invite-counter-banner-actions button.go-chat { background: rgba(34,211,238,0.2); border-color: #22d3ee; color: #67e8f9; }
.invite-counter-banner-actions button.vote-yes { background: rgba(34,197,94,0.2); border-color: #22c55e; color: #86efac; }
.invite-counter-banner-actions button.vote-no { background: rgba(248,113,113,0.2); border-color: #f87171; color: #fca5a5; }
