/* Palette ispirata alla stampa risograph dei manifesti di concerti:
   carta fredda, inchiostro blu-notte, blu e rosa fluo come colori spot. */
:root {
  --paper: #F3F5F9;
  --card: #FFFFFF;
  --ink: #161A2E;
  --muted: #5B6278;
  --line: #D8DDE8;
  --blue: #0078BF;
  --pink: #FF48B0;
  --blue-soft: #E1EEF8;
  --font: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  /* variabili lette da FullCalendar */
  --fc-border-color: var(--line);
  --fc-page-bg-color: var(--paper);
  --fc-neutral-bg-color: #E9EDF4;
  --fc-today-bg-color: #FFE7F4;
  --fc-now-indicator-color: var(--pink);
  --fc-event-bg-color: var(--blue);
  --fc-event-border-color: var(--blue);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121523;
    --card: #1B1F31;
    --ink: #E9ECF5;
    --muted: #9AA1B8;
    --line: #2C3249;
    --blue: #3AA0E8;
    --blue-soft: #1C2D44;
    --fc-neutral-bg-color: #191D2D;
    --fc-today-bg-color: #2A1B2C;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
}
:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
button, input { font: inherit; color: inherit; }

/* ------------------------------------------------------------ barra alta */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px 10px;
}
.icon-btn {
  width: 44px; height: 44px;
  display: grid; place-content: center; gap: 5px;
  background: none; border: 0; border-radius: 10px; cursor: pointer;
}
.icon-btn span { display: block; width: 24px; height: 3px; background: var(--ink); border-radius: 2px; }
.icon-btn:hover { background: var(--fc-neutral-bg-color); }

.add-form { flex: 1; min-width: 0; display: flex; gap: 8px; max-width: 760px; }
.add-form input {
  flex: 1; min-width: 0; width: 100%;
  padding: 11px 14px;
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: 12px;
}
.add-form input:focus { border-color: var(--blue); outline: none; }

.primary {
  display: inline-block;
  padding: 11px 18px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 12px;
  font-weight: 700; text-decoration: none; cursor: pointer;
  box-shadow: 3px 3px 0 var(--pink);          /* "fuori registro" riso */
  transition: transform .08s, box-shadow .08s;
}
.primary:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--pink); }
.primary:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--pink); }
.ghost {
  padding: 9px 14px; background: none; cursor: pointer;
  border: 2px solid var(--line); border-radius: 12px; font-weight: 600;
}
.ghost:hover { border-color: var(--ink); }

/* ------------------------------------------------------------ incolla link (telefono) */
.paste-btn { display: none; white-space: nowrap; }

/* evento trovato da un solo modello: bordo tratteggiato, da verificare */
.ev.uncertain .ev-poster, .ev.uncertain.no-poster .ev-inner { outline: 2px dashed var(--pink); outline-offset: 1px; }
.m-uncertain {
  margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 14px;
  border: 2px dashed var(--pink); color: var(--ink);
}

/* ------------------------------------------------------------ account */
.user-btn { margin-left: auto; color: var(--ink); border: 2px solid var(--line); border-radius: 50%; }
.user-btn:hover { border-color: var(--ink); }
.topbar { position: relative; }
.user-menu {
  position: absolute; top: 62px; right: 20px; z-index: 40; min-width: 220px;
  padding: 14px 16px; background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--pink); display: grid; gap: 4px;
}
.u-label { margin: 0; color: var(--muted); font-size: 13px; }
.u-name { margin: 0 0 6px; font-weight: 800; font-size: 20px; font-stretch: 80%; }
.u-invite { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.u-invite code { font-size: 15px; color: var(--ink); background: var(--paper); padding: 1px 6px; border-radius: 6px; }

.auth {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px;
  background: var(--paper);
}
.auth-card {
  width: min(400px, 100%); padding: 30px 28px; background: var(--card);
  border: 2px solid var(--line); border-radius: 18px; box-shadow: 8px 8px 0 var(--pink);
}
.auth-card h1 { margin: 0 0 20px; font-size: 44px; line-height: .95; font-weight: 800; font-stretch: 68%; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 18px; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.auth-tabs button { padding: 10px; border: 0; background: none; font-weight: 700; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
#auth-form { display: grid; gap: 12px; }
#auth-form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); }
#auth-form input {
  padding: 10px 12px; font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 10px;
}
#auth-form input:focus { border-color: var(--blue); outline: none; }
.auth-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--blue-soft); font-size: 14px; }
.auth-error { margin: 0; color: #C62F34; font-weight: 600; font-size: 14px; }
#auth-submit { margin-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  margin: 0; padding: 10px 16px; z-index: 50;
  background: var(--ink); color: var(--paper); border-radius: 10px;
  max-width: min(90vw, 520px);
}

/* ------------------------------------------------------------ calendario */
#calendar { flex: 1; min-height: 0; padding: 0 20px 20px; overflow-y: auto; }

/* Mese: caselle con proporzioni fisse "a quadretto" (un po' più alte che
   larghe, come un poster o un telefono). Cambia --day-ratio per regolarle. */
:root { --day-ratio: 4 / 5; }
/* aspect-ratio fissa l'altezza minima: se il contenuto non ci sta, la riga cresce */
.fc-dayGridMonth-view .fc-daygrid-day-frame { aspect-ratio: var(--day-ratio); width: 100%; }
/* width fissa: se una casella della riga è più alta, cresce in altezza e non si allarga */
.fc-dayGridMonth-view .ev.one-day .ev-poster { height: auto; aspect-ratio: 4 / 3; }
.fc-dayGridMonth-view .ev-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.fc .fc-toolbar.fc-header-toolbar { margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
.fc .fc-toolbar-title {
  font-size: clamp(28px, 4.2vw, 52px);
  font-weight: 800;
  font-stretch: 70%;              /* titolo stretto e alto, da manifesto */
  letter-spacing: -0.01em;
  line-height: 1;
  text-transform: capitalize;
}
.fc .fc-button {
  background: var(--card); color: var(--ink);
  border: 2px solid var(--line); border-radius: 10px;
  font-weight: 600; text-transform: none; box-shadow: none;
}
.fc .fc-button:hover { border-color: var(--ink); background: var(--card); color: var(--ink); }
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.fc .fc-button:focus { box-shadow: none; }
.fc .fc-button:disabled { opacity: .45; background: var(--card); color: var(--ink); border-color: var(--line); }
.fc .fc-button-group > .fc-button { border-radius: 0; }
.fc .fc-button-group > .fc-button:first-child { border-radius: 10px 0 0 10px; }
.fc .fc-button-group > .fc-button:last-child { border-radius: 0 10px 10px 0; }
.fc .fc-col-header-cell-cushion { color: var(--muted); font-weight: 600; padding: 6px 4px; }
.fc .fc-daygrid-day-number { color: var(--ink); font-weight: 700; font-stretch: 80%; font-size: 17px; }
.fc .fc-day-today .fc-daygrid-day-number { color: var(--pink); }
.fc .fc-scrollgrid { background: var(--card); border-radius: 12px; overflow: hidden; }
.fc a { color: inherit; }
.fc .fc-daygrid-more-link { color: var(--blue); font-weight: 700; }
.fc .fc-popover { background: var(--card); }

/* evento: locandina + titolo */
.fc .fc-event { cursor: pointer; }
.fc .fc-daygrid-event.ev { background: none; border: 0; padding: 0; margin: 2px 3px 6px; white-space: normal; }
.fc .fc-daygrid-dot-event.ev { display: block; }
.ev-inner { display: flex; flex-direction: column; gap: 4px; min-width: 0; width: 100%; }
.ev-poster {
  width: 100%; height: 118px; object-fit: cover; object-position: center top; display: block;
  border-radius: 6px; background: var(--blue-soft);
  box-shadow: 3px 3px 0 var(--pink);
}
.ev-text { font-size: 13px; line-height: 1.2; color: var(--ink); min-width: 0; }
.ev-time { font-weight: 700; color: var(--blue); margin-right: 4px; }
.ev-title { font-weight: 600; font-stretch: 85%; }
.ev.no-poster .ev-inner {
  background: var(--blue); border-radius: 6px; padding: 5px 7px;
}
.ev.no-poster .ev-text, .ev.no-poster .ev-time { color: #fff; }
@media (hover: hover) {
  .fc .fc-event.ev:hover .ev-poster { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--pink); }
}

/* evento su più giorni (barra orizzontale): miniatura piccola a sinistra */
.fc .fc-daygrid-block-event.ev.multi-day .ev-inner { flex-direction: row; align-items: center; gap: 8px; }
.fc .fc-daygrid-block-event.ev.multi-day .ev-poster { width: 36px; height: 48px; flex: none; box-shadow: 2px 2px 0 var(--pink); }
.fc .fc-daygrid-block-event.ev.multi-day.has-poster .ev-inner { background: var(--blue-soft); border-radius: 6px; padding: 4px; }

/* vista settimana: la locandina fa da sfondo al blocco orario */
.fc-timegrid-event.ev { border: 0; border-radius: 8px; overflow: hidden; background: var(--blue); }
.fc-timegrid-event.ev .ev-inner { height: 100%; position: relative; }
.fc-timegrid-event.ev .ev-poster {
  position: absolute; inset: 0; height: 100%; aspect-ratio: auto;
  box-shadow: none; border-radius: 0;
}
.fc-timegrid-event.ev .ev-text {
  position: relative; margin-top: auto; padding: 18px 6px 5px; color: #fff;
  background: linear-gradient(transparent, rgba(10, 12, 25, .85));
}
.fc-timegrid-event.ev .ev-time { color: #fff; }
.fc-timegrid-event.ev.no-poster .ev-text { background: none; margin-top: 0; padding-top: 5px; }

/* ------------------------------------------------------------ pannello */
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 25, .35); z-index: 20; }
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 30;
  width: min(420px, 92vw);
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px 18px 22px;
  background: var(--card); border-right: 2px solid var(--line);
  transform: translateX(-102%); transition: transform .22s ease-out;
  overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-head h2 { margin: 0; font-size: 28px; font-weight: 800; font-stretch: 70%; }
.icon-x {
  width: 40px; height: 40px; border: 0; border-radius: 10px; cursor: pointer;
  background: none; font-size: 30px; line-height: 1;
}
.icon-x:hover { background: var(--fc-neutral-bg-color); }
.llm-status { margin: 0; padding: 10px 12px; border-radius: 10px; background: #FFF4D6; color: #5A4300; font-size: 14px; }
@media (prefers-color-scheme: dark) { .llm-status { background: #3A3218; color: #F5E2A8; } }
.empty { color: var(--muted); margin: 0; }
.source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.source {
  display: grid; grid-template-columns: 10px 1fr auto auto auto; gap: 4px 6px; align-items: center;
  padding: 10px 8px 10px 12px; border: 2px solid var(--line); border-radius: 12px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: #1FA971; }
.dot.error { background: #E5484D; }
.dot.running, .dot.queued { background: var(--blue); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
.src-main { min-width: 0; }
.src-host { font-weight: 700; }
.src-by { color: var(--muted); font-size: 13px; }
.src-url { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src-msg { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.source.error .src-msg { color: #C62F34; }
.src-btn {
  border: 0; background: none; cursor: pointer; border-radius: 8px; padding: 6px 8px;
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.src-btn:hover { background: var(--fc-neutral-bg-color); color: var(--ink); }
.src-btn.remove:hover { color: #C62F34; }
#refresh-all { align-self: flex-start; margin-top: 4px; }

/* ------------------------------------------------------------ finestra evento */
.event-modal {
  width: min(920px, 94vw); max-height: 90vh; padding: 0;
  border: 0; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 8px 8px 0 var(--pink);
}
.event-modal::backdrop { background: rgba(10, 12, 25, .6); }
.event-modal[open] { animation: pop .16s ease-out; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--card); }
.modal-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); max-height: 90vh; }
.modal-body.no-poster { grid-template-columns: 1fr; }
.m-poster { margin: 0; background: var(--ink); display: grid; place-items: center; min-height: 0; }
.m-poster img { width: 100%; height: 100%; max-height: 90vh; object-fit: contain; display: block; }
.m-info { padding: 34px 30px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.m-info h2 { margin: 0; padding-right: 36px; font-size: clamp(26px, 3.4vw, 40px); line-height: 1.02; font-weight: 800; font-stretch: 72%; }
.m-when { margin: 0; font-weight: 700; color: var(--blue); font-size: 17px; }
.m-where { margin: 0; font-weight: 600; }
.m-where a { color: inherit; text-decoration-color: var(--pink); text-underline-offset: 3px; }
.m-desc { margin: 0; color: var(--muted); max-width: 60ch; white-space: pre-line; }
.m-actions { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.m-source { color: var(--muted); font-size: 13px; margin: 0; }
.m-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
#m-edit .p-event { border: 0; padding: 0; }
.learn-info { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.learn-info a { color: var(--blue); }

/* ------------------------------------------------------------ vista giorno (lista) */
.fc .fc-list { border-radius: 12px; overflow: hidden; background: var(--card); }
.fc .fc-list-day-cushion { background: var(--fc-neutral-bg-color); }
.fc .fc-list-day-text, .fc .fc-list-day-side-text { font-weight: 800; font-stretch: 80%; font-size: 17px; }
.fc .fc-list-event-graphic { display: none; }
/* righe a griglia invece che a tabella: larghezze fisse (orario 64 px, il resto
   all'evento), che non si ricalcolano quando si tocca un evento */
.fc .fc-list-table, .fc .fc-list-table tbody { display: block; width: 100%; }
.fc .fc-list-table tr.fc-list-day { display: block; }
.fc .fc-list-table tr.fc-list-day > th { display: block; }
.fc .fc-list-table tr.fc-list-event { display: grid; grid-template-columns: 64px minmax(0, 1fr); }
.fc .fc-list-table tr.fc-list-event > td { display: block; min-width: 0; }
.fc .fc-list-table tr.fc-list-event > td.fc-list-event-graphic { display: none; }
.fc .fc-list-event-time { font-weight: 700; color: var(--blue); white-space: nowrap; vertical-align: top; }
.fc .fc-list-event.ev td { background: var(--card); }
@media (hover: hover) { .fc .fc-list-event.ev:hover td { background: var(--paper); } }
.fc .fc-list-event.ev .ev-inner { gap: 8px; }
.fc .fc-list-event.ev .ev-poster {
  width: 100%; height: auto; max-height: 70vh; object-fit: contain; aspect-ratio: auto;
  background: var(--ink);
}
.fc .fc-list-event.ev .ev-text { font-size: 17px; line-height: 1.25; }
.fc .fc-list-event.ev .ev-title { font-weight: 800; font-stretch: 80%; }
.fc .fc-list-event.ev .ev-where { display: block; color: var(--muted); font-size: 14px; font-weight: 600; margin-top: 2px; }
.fc .fc-list-event.ev.no-poster .ev-inner { background: none; padding: 0; }
.fc .fc-list-event.ev.no-poster .ev-text { color: var(--ink); }
.fc .fc-list-empty { background: var(--card); color: var(--muted); }

/* ------------------------------------------------------------ giornata */
.fc .fc-daygrid-day, .fc .fc-timegrid-slot { cursor: pointer; }
.fc a.fc-daygrid-day-number:hover, .fc a.fc-col-header-cell-cushion:hover { color: var(--pink); text-decoration: none; }
.day-modal {
  width: min(640px, 94vw); height: min(86vh, 900px); padding: 0;
  border: 0; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 8px 8px 0 var(--pink);
}
.day-modal[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.day-modal::backdrop { background: rgba(10, 12, 25, .6); }
.d-head {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px;
  padding: 14px 14px 12px; border-bottom: 2px solid var(--line);
}
.d-head h2 {
  margin: 0; text-align: center; font-size: clamp(22px, 4vw, 32px); font-weight: 800;
  font-stretch: 72%; line-height: 1.05;
}
.d-head .modal-close { position: static; }
.d-list { list-style: none; margin: 0; padding: 14px; overflow-y: auto; display: grid; gap: 12px; }
.d-card {
  width: 100%; display: grid; grid-template-columns: 110px 1fr; gap: 14px; align-items: start;
  padding: 10px; text-align: left; cursor: pointer;
  background: var(--paper); border: 2px solid var(--line); border-radius: 12px;
}
.d-card:hover { border-color: var(--ink); }
.d-card.no-poster { grid-template-columns: 1fr; }
.d-card img {
  width: 110px; height: 146px; object-fit: cover; border-radius: 8px; display: block;
  background: var(--blue-soft); box-shadow: 3px 3px 0 var(--pink);
}
.d-time { display: block; font-weight: 700; color: var(--blue); }
.d-name { display: block; font-size: 19px; font-weight: 800; font-stretch: 78%; line-height: 1.1; margin: 2px 0 6px; }
.d-where { display: block; font-weight: 600; font-size: 14px; }
.d-desc {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--muted); font-size: 14px; margin-top: 4px;
}
.d-empty { margin: 0; padding: 24px; color: var(--muted); }

/* ------------------------------------------------------------ foto */
.photo-btn { white-space: nowrap; padding: 9px 14px; }
.photo-menu {
  position: absolute; top: 62px; z-index: 40; min-width: 220px; padding: 6px;
  background: var(--card); border: 2px solid var(--line); border-radius: 14px;
  box-shadow: 4px 4px 0 var(--pink); display: grid;
}
.photo-menu button {
  padding: 12px 14px; border: 0; border-radius: 10px; background: none;
  text-align: left; font-weight: 700; cursor: pointer;
}
.photo-menu button:hover, .photo-menu button:focus-visible { background: var(--paper); }
.danger:hover { border-color: #C62F34; color: #C62F34; }
.photo-modal {
  width: min(980px, 95vw); max-height: 92vh; padding: 0;
  border: 0; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 8px 8px 0 var(--pink);
}
.photo-modal::backdrop { background: rgba(10, 12, 25, .6); }
/* altezza fissa: la colonna dei moduli scorre, l'immagine resta visibile */
.p-body { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
          grid-template-rows: 100%; height: min(92vh, 1000px); }
.p-img { margin: 0; background: var(--ink); display: grid; place-items: center; min-height: 240px; overflow: hidden; }
.p-img img { max-width: 100%; max-height: 92vh; object-fit: contain; display: block; }
.p-side { padding: 30px 26px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.p-side h2 { margin: 0 40px 0 0; font-size: 30px; font-weight: 800; font-stretch: 72%; line-height: 1; }
.p-status { margin: 0; color: var(--muted); }
.p-status.busy::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  border-radius: 50%; background: var(--blue); animation: pulse 1s infinite alternate;
}
.p-pick { display: grid; gap: 4px; }
.p-pick > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.p-thumbs { display: flex; flex-wrap: wrap; gap: 6px; }
.p-thumb {
  width: 52px; height: 52px; padding: 0; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--line); background: var(--paper); overflow: hidden;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.p-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-thumb[aria-pressed="true"] { border-color: var(--pink); box-shadow: 2px 2px 0 var(--pink); }
.p-check { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 12px; }
.p-event { border: 2px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; display: grid; gap: 8px; }
.p-event label { font-size: 13px; font-weight: 600; color: var(--muted); display: grid; gap: 3px; }
.p-event input, .p-event textarea {
  font: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--line); border-radius: 10px; padding: 7px 10px; width: 100%;
}
.p-event input:focus, .p-event textarea:focus { border-color: var(--blue); outline: none; }
.p-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.p-event .src-btn { justify-self: end; }
.p-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.drop-hint {
  position: fixed; inset: 12px; z-index: 60; display: grid; place-items: center;
  border: 4px dashed var(--pink); border-radius: 20px; background: rgba(10, 12, 25, .55);
  color: #fff; font-size: 28px; font-weight: 800; font-stretch: 75%; pointer-events: none;
}
@media (max-width: 700px) {
  .p-body { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; max-height: 92vh; overflow-y: auto; }
  .p-img img { max-height: 40vh; }
  .p-row { grid-template-columns: 1fr 1fr; }
  .photo-btn { padding: 9px 10px; }
}

/* ------------------------------------------------------------ segnalazione */
.report-modal {
  width: min(520px, 94vw); padding: 28px 26px 24px;
  border: 0; border-radius: 16px; background: var(--card); color: var(--ink);
  box-shadow: 8px 8px 0 var(--pink);
}
.report-modal::backdrop { background: rgba(10, 12, 25, .6); }
.report-modal h2 { margin: 0 40px 14px 0; font-size: 28px; font-weight: 800; font-stretch: 72%; line-height: 1.05; }
.report-modal label { display: block; font-weight: 600; margin-bottom: 8px; }
.report-modal textarea {
  width: 100%; padding: 10px 12px; resize: vertical;
  background: var(--paper); border: 2px solid var(--line); border-radius: 12px;
}
.report-modal textarea:focus { border-color: var(--blue); outline: none; }
.r-help { color: var(--muted); font-size: 14px; margin: 12px 0 18px; }

@media (max-width: 700px) {
  :root { --day-ratio: 3 / 5; }
  /* caselle strette: nel mese solo la locandina, il titolo è nella giornata */
  .fc-dayGridMonth-view .ev.has-poster .ev-text { display: none; }
  .fc-dayGridMonth-view .ev.one-day .ev-poster { aspect-ratio: 1 / 1; }
  .topbar { padding: 10px 12px 8px; gap: 8px; flex-wrap: nowrap; }
  /* simmetria: due icone tonde uguali ai lati, due pulsanti uguali al centro */
  #menu-btn { border: 2px solid var(--line); border-radius: 50%; flex: none; }
  .user-btn { margin-left: 0; flex: none; }
  .paste-btn, .photo-btn {
    flex: 1 1 0; min-width: 0; height: 44px; padding: 0 8px; text-align: center;
    background: var(--ink); color: var(--paper); border: 0; border-radius: 12px;
    font-weight: 700; box-shadow: 3px 3px 0 var(--pink);
  }
  /* barra del calendario: titolo centrato, due righe di pulsanti a tutta larghezza */
  .fc .fc-header-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .fc .fc-header-toolbar .fc-toolbar-chunk:empty { display: none; }
  .fc .fc-toolbar-title { text-align: center; }
  .fc .fc-header-toolbar .fc-toolbar-chunk:last-child { display: flex; flex-direction: column; gap: 8px; }
  .fc .fc-header-toolbar .fc-toolbar-chunk:last-child .fc-button-group { display: flex; width: 100%; margin: 0; }
  .fc .fc-header-toolbar .fc-toolbar-chunk:last-child .fc-button { flex: 1 1 0; padding: 8px 4px; }
  /* telefono: niente campo di testo, solo il pulsante "Incolla link" */
  .add-form { display: none; }
  .paste-btn { display: inline-block; padding: 10px 14px; }
  .add-form .primary { padding: 11px 12px; }
  #calendar { padding: 0 8px 12px; }
  .modal-body { grid-template-columns: 1fr; overflow-y: auto; }
  .m-poster img { max-height: 55vh; }
  .m-info { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* link di condivisione: solo "Accedi", la scheda occupa tutta la riga */
.auth-tabs:has(#tab-register[hidden]) { grid-template-columns: 1fr; }

/* ------------------------------------------------------------ telefono: locandina sopra, testo sotto */
@media (max-width: 700px) {
  .event-modal .modal-body { display: flex; flex-direction: column; max-height: 90vh; overflow-y: auto; }
  .event-modal .m-poster { flex: none; min-height: auto; position: static; }
  .event-modal .m-poster img { height: auto; max-height: 55vh; position: static; }
  .event-modal .m-info { flex: none; position: static; overflow: visible; padding: 20px 18px 22px; }
  .event-modal .modal-body:not(.no-poster) .m-info h2 { padding-right: 0; }
}
