/* Agenda: cronologia leggibile, consultazione rapida e modifica evento. */
.agenda-timeline {
  grid-template-columns: minmax(0, 1fr);
}

.agenda-tappa,
.agenda-giornata > div,
.evento-nota-frame {
  min-width: 0;
  max-width: 100%;
}

.evento-nota-frame {
  display: block;
}

.appointment-notes {
  margin: 0.8rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.appointment-notes-summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}

.appointment-notes-summary::-webkit-details-marker {
  display: none;
}

.appointment-notes-summary > span {
  flex: 1;
  min-width: 0;
}

.appointment-notes-summary svg,
.appointment-note-add svg,
.evento-delete-button svg,
.agenda-notes-dialog-bar svg {
  width: 1.1rem;
  height: 1.1rem;
  flex: none;
}

.appointment-notes[open] > summary > svg:last-child {
  transform: rotate(45deg);
}

.appointment-notes-preview {
  display: block;
  margin-top: 0.3rem;
  color: var(--gray-text);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.appointment-notes-content {
  padding: 0 1rem 1rem;
}

.appointment-note {
  padding: 1.1rem 0;
  border-top: 1px solid var(--border);
}

.appointment-note:last-child {
  padding-bottom: 0;
}

.appointment-note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.8rem;
  align-items: baseline;
  font-size: 0.76rem;
  color: var(--gray-text);
}

.appointment-note-meta strong {
  font-size: 0.83rem;
  color: var(--navy);
}

.appointment-note-body {
  margin: 0.6rem 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.93rem;
  line-height: 1.65;
  color: var(--ink);
}

.appointment-note-edited {
  font-size: 0.73rem;
  color: var(--gray-text);
}

.appointment-note-edit > summary {
  display: inline-block;
  padding: 0.45rem 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
  cursor: pointer;
}

.appointment-note-compose {
  margin-bottom: 0.8rem;
}

.appointment-note-add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem;
  border: 1px dashed var(--azure);
  border-radius: var(--radius-small);
  background: var(--azure-soft);
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}

.appointment-note-form {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.appointment-note-form label {
  font-size: 0.8rem;
  color: var(--gray-text);
}

.appointment-note-form textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 7rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  resize: vertical;
}

.appointment-note-form button {
  justify-self: start;
}

.agenda-notes-dialog {
  box-sizing: border-box;
  width: min(38rem, calc(100vw - 2rem));
  max-height: 85dvh;
  padding: 1.3rem;
  border: 1px solid var(--border);
  border-radius: 1.3rem;
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  overscroll-behavior: contain;
}

.agenda-notes-dialog::backdrop {
  background: rgb(15 23 42 / 48%);
  backdrop-filter: blur(3px);
}

.agenda-notes-dialog-bar {
  display: flex;
  justify-content: flex-end;
}

.agenda-notes-heading h2 {
  margin: 0.5rem 0;
  font-size: 1.4rem;
}

.agenda-notes-heading > p:not(.eyebrow) {
  font-size: 0.85rem;
  color: var(--gray-text);
}

.agenda-sett-evento-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-right: 1.9rem;
  color: inherit;
  text-decoration: none;
}

.agenda-sett-notes {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  min-height: 1.7rem;
  padding: 0.2rem;
  border-radius: 0.35rem;
  background: var(--surface);
  color: var(--navy);
  font-size: 0.7rem;
  text-decoration: none;
}

.agenda-sett-notes svg {
  width: 0.9rem;
  height: 0.9rem;
}

.evento-page.is-edit {
  max-width: none;
}

.evento-edit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 0.65fr);
  gap: 1.8rem;
  align-items: start;
}

.evento-note-sidebar {
  position: sticky;
  top: 6rem;
  padding: 1.25rem;
  margin-top: 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, var(--azure-soft), var(--surface) 55%);
  box-shadow: var(--shadow-1);
}

.evento-note-sidebar h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--navy);
}

.is-edit .evento-azioni {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.evento-delete-zone {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.5rem;
  padding: 1rem;
  border-top: 1px solid var(--border);
}

.evento-delete-zone strong {
  font-size: 0.87rem;
  color: var(--ink);
}

.evento-delete-zone p {
  margin: 0.3rem 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--gray-text);
}

.evento-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--danger);
  border-radius: 999px;
  background: var(--surface);
  color: var(--danger);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}

.evento-delete-button:hover {
  background: var(--danger);
  color: var(--surface);
}

@media (max-width: 64rem) {
  .evento-edit-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }

  .evento-note-sidebar {
    position: static;
    grid-row: 1;
  }
}

@media (max-width: 48rem) {
  .evento-delete-zone {
    flex-wrap: wrap;
    padding-bottom: 2rem;
  }
}
