/* ==========================================================
   Povering — Material Design 3
   I token colore sono i default (tema chiaro, lilla):
   ThemeManager li sovrascrive a runtime in base al profilo.
   ========================================================== */

:root {
  /* Palette Material Design 3 (default, sovrascritta dal tema) */
  --md-primary: #6750a4;
  --md-on-primary: #ffffff;
  --md-primary-container: #eaddff;
  --md-on-primary-container: #21005d;
  --md-secondary-container: #e8def8;
  --md-on-secondary-container: #1d192b;
  --md-surface: #fef7ff;
  --md-surface-card: #ffffff;
  --md-surface-container: #f3edf7;
  --md-surface-container-high: #ece6f0;
  --md-on-surface: #1d1b20;
  --md-on-surface-variant: #49454f;
  --md-outline: #79747e;
  --md-outline-variant: #cac4d0;
  --md-snackbar-bg: #322f35;
  --md-snackbar-fg: #f5eff7;

  /* Colori fissi indipendenti dal tema */
  --md-error: #b3261e;
  --md-green: #2e7d32;
  --md-yellow: #f4b400;

  --radius-s: 8px;
  --radius-m: 16px;
  --radius-l: 28px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Roboto', sans-serif;
  background: var(--md-surface);
  color: var(--md-on-surface);
  min-height: 100vh;
  /* Su touch il feedback è il ripple, non l'evidenziazione del browser */
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}

/* ---------- Elevazioni ---------- */
.elevation-1 { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 1px 3px 1px rgba(0,0,0,.15); }
.elevation-2 { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15); }
.elevation-3 { box-shadow: 0 4px 8px 3px rgba(0,0,0,.15), 0 1px 3px rgba(0,0,0,.3); }
.elevation-4 { box-shadow: 0 6px 10px 4px rgba(0,0,0,.15), 0 2px 3px rgba(0,0,0,.3); }

/* ---------- Pulsanti ---------- */
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: .1px;
  border: none;
  border-radius: 20px;
  padding: 10px 24px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: box-shadow .2s, background-color .2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-filled {
  background: var(--md-primary);
  color: var(--md-on-primary);
}
.btn-filled:hover { box-shadow: 0 1px 3px rgba(0,0,0,.3); filter: brightness(1.08); }

.btn-tonal {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}
.btn-tonal:hover { filter: brightness(.97); }

.btn-text {
  background: transparent;
  color: var(--md-primary);
}
.btn-text:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); }

.btn-outlined {
  background: transparent;
  color: var(--md-primary);
  border: 1px solid var(--md-outline);
}
.btn-outlined:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); }

.btn-danger { color: var(--md-error); }
.btn-danger.btn-filled { background: var(--md-error); color: #fff; }
.btn-danger.btn-text:hover { background: color-mix(in srgb, var(--md-error) 8%, transparent); }

.btn .material-symbols-outlined { font-size: 18px; }

.icon-btn {
  background: transparent;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: inherit;
  position: relative;
  transition: background-color .2s;
}
.icon-btn:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.icon-btn-small { width: 32px; height: 32px; }
.icon-btn-small .material-symbols-outlined { font-size: 20px; }

/* ---------- Ripple ---------- */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .25;
  transform: scale(0);
  animation: ripple .5s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(2.5); opacity: 0; }
}

/* ---------- Text field (outlined, floating label) ---------- */
.text-field {
  position: relative;
  margin-bottom: 22px;
  width: 100%;
}

.text-field input,
.text-field textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--md-on-surface);
  background: transparent;
  border: 1px solid var(--md-outline);
  border-radius: 4px;
  padding: 14px 16px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  resize: vertical;
  color-scheme: light;
}

[data-theme="dark"] .text-field input,
[data-theme="dark"] .text-field textarea { color-scheme: dark; }

.text-field input:focus,
.text-field textarea:focus {
  border-color: var(--md-primary);
  box-shadow: inset 0 0 0 1px var(--md-primary);
}

.text-field label {
  position: absolute;
  left: 12px;
  top: 14px;
  font-size: 16px;
  color: var(--md-on-surface-variant);
  background: var(--md-surface);
  padding: 0 4px;
  pointer-events: none;
  transition: all .15s ease;
}

.dialog .text-field label { background: var(--md-surface-container-high); }
.login-card .text-field label { background: var(--md-surface-card); }

.text-field input:focus + label,
.text-field input:not(:placeholder-shown) + label,
.text-field input[type="date"] + label,
.text-field input[type="time"] + label,
.text-field textarea:focus + label,
.text-field textarea:not(:placeholder-shown) + label {
  top: -8px;
  font-size: 12px;
  color: var(--md-primary);
}

.text-field input:not(:focus):not(:placeholder-shown) + label,
.text-field input[type="date"]:not(:focus) + label,
.text-field input[type="time"]:not(:focus) + label,
.text-field textarea:not(:focus):not(:placeholder-shown) + label {
  color: var(--md-on-surface-variant);
}

.field-row { display: flex; gap: 16px; }
.field-row .text-field { flex: 1; }

/* ==========================================================
   LOGIN
   ========================================================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--md-primary-container), var(--md-surface));
  padding: 24px;
}

.login-card {
  background: var(--md-surface-card);
  border-radius: var(--radius-l);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 48px;
  color: var(--md-primary);
}

.login-header h1 {
  font-size: 28px;
  font-weight: 400;
  margin-top: 8px;
}

.login-subtitle {
  color: var(--md-on-surface-variant);
  font-size: 14px;
  margin-top: 4px;
}

.login-error {
  color: var(--md-error);
  font-size: 13px;
  margin: -10px 0 16px;
}

.login-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 8px;
}

/* ==========================================================
   APP — barra superiore
   ========================================================== */
.top-app-bar {
  height: 64px;
  background: var(--md-surface-container);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-app-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-app-bar-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 22px;
  font-weight: 500;
  color: var(--md-on-surface);
}

.top-app-bar-title .material-symbols-outlined { color: var(--md-primary); }

/* Separatore visivo tra titolo e bottone Home */
.top-app-bar-left .btn-text {
  border-left: 1px solid var(--md-outline-variant);
  border-radius: 0 20px 20px 0;
  padding-left: 16px;
  margin-left: 4px;
  font-size: 14px;
}

.top-app-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  border: none;
  border-radius: 20px;
  padding: 4px 16px 4px 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: filter .15s;
}
.user-chip:hover { filter: brightness(.95); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--md-primary);
  color: var(--md-on-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 500;
  text-transform: uppercase;
  flex-shrink: 0;
  object-fit: cover;
}

.avatar-small {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

/* ---------- Notifiche (campanella + tendina) ---------- */
.notif-wrap { position: relative; }

.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--md-error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.notif-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 340px;
  max-width: 90vw;
  background: var(--md-surface-container-high);
  border-radius: var(--radius-m);
  overflow: hidden;
  z-index: 60;
  animation: dialog-in .15s ease;
}

.notif-header {
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--md-on-surface);
  border-bottom: 1px solid var(--md-outline-variant);
}

.notif-list {
  list-style: none;
  max-height: 360px;
  overflow-y: auto;
}

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  border-bottom: 1px solid var(--md-outline-variant);
  transition: background-color .15s;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); }
.notif-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--md-primary);
  flex-shrink: 0;
}
.notif-text { line-height: 1.4; }

.notif-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--md-outline);
}

/* ==========================================================
   Layout principale: pannello 80% / calendario 20%
   ========================================================== */
.app-body {
  display: flex;
  gap: 24px;
  padding: 24px;
  align-items: flex-start;
}

.main-panel { flex: 0 0 calc(80% - 24px); max-width: calc(80% - 24px); }

.sidebar {
  flex: 0 0 20%;
  max-width: 20%;
  position: sticky;
  top: 88px;
}

.section-title {
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 16px;
  color: var(--md-on-surface);
}

/* ---------- Lista eventi ---------- */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.event-card {
  background: var(--md-surface-container);
  border-radius: var(--radius-m);
  padding: 20px 24px;
  transition: box-shadow .2s;
}
.event-card:hover { box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 2px 6px 2px rgba(0,0,0,.15); }

/* Card compleanno (solo nella vista giorno) */
.birthday-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: color-mix(in srgb, var(--md-yellow) 18%, var(--md-surface-container));
  border: 1px solid color-mix(in srgb, var(--md-yellow) 55%, transparent);
  border-radius: var(--radius-m);
  padding: 14px 24px;
  font-size: 15px;
  color: var(--md-on-surface);
}

.birthday-icon {
  color: var(--md-yellow);
  font-size: 26px;
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.event-title {
  font-size: 18px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.event-past-badge {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--md-on-surface-variant);
  background: var(--md-surface-container-high);
  border: 1px solid var(--md-outline-variant);
  border-radius: 8px;
  padding: 2px 8px;
}

.event-card-past { opacity: .72; }

.event-actions {
  display: flex;
  gap: 4px;
}

.event-datetime {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
  padding: 6px 12px;
  white-space: nowrap;
}
.event-datetime .material-symbols-outlined { font-size: 16px; }

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
  font-size: 14px;
  color: var(--md-on-surface-variant);
}

.event-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.event-meta-item .material-symbols-outlined { font-size: 18px; }

.event-description {
  margin-top: 10px;
  font-size: 14px;
  color: var(--md-on-surface-variant);
  line-height: 1.5;
}

.event-divider {
  border: none;
  border-top: 1px solid var(--md-outline-variant);
  margin: 14px 0;
}

.event-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.participants {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.participants-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
}

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--md-surface-container-high);
  border: 1px solid var(--md-outline-variant);
  border-radius: 16px;
  padding: 3px 12px 3px 3px;
  font-size: 13px;
}

.no-participants {
  font-size: 13px;
  color: var(--md-outline);
  font-style: italic;
}

/* ---------- Stato vuoto ---------- */
.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--md-on-surface-variant);
}
.empty-state .material-symbols-outlined { font-size: 64px; color: var(--md-outline-variant); }
.empty-state p { margin-top: 12px; font-size: 16px; }
.empty-hint { font-size: 14px !important; color: var(--md-outline); }

/* ==========================================================
   Calendario minimale
   ========================================================== */
.calendar-card {
  background: var(--md-surface-container);
  border-radius: var(--radius-m);
  padding: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-title {
  font-size: 14px;
  font-weight: 500;
  text-transform: capitalize;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  text-align: center;
}

.calendar-weekdays span {
  font-size: 11px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  padding: 4px 0;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 50%;
  position: relative;
  color: var(--md-on-surface);
  cursor: pointer;
  transition: background-color .15s;
}

.calendar-day:hover:not(.today):not(.selected) {
  background: color-mix(in srgb, var(--md-primary) 12%, transparent);
}

.calendar-day.other-month {
  color: var(--md-outline-variant);
  cursor: default;
}

/* Giorno selezionato: sfondo secondario pieno */
.calendar-day.selected:not(.today) {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  font-weight: 700;
}

.calendar-day.today.selected {
  box-shadow: inset 0 0 0 3px var(--md-green);
}

.calendar-day.today {
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-weight: 700;
}

/* Cerchio verde = eventi nel giorno */
.calendar-day.has-event {
  box-shadow: inset 0 0 0 2px var(--md-green);
  font-weight: 500;
}

/* Cerchio giallo = compleanno (da solo, senza eventi) */
.calendar-day.has-birthday:not(.has-event) {
  box-shadow: inset 0 0 0 2px var(--md-yellow);
  font-weight: 500;
}

/* Compleanno + eventi: cerchio giallo concentrico dentro quello verde */
.calendar-day.has-event.has-birthday {
  box-shadow:
    inset 0 0 0 2px var(--md-green),
    inset 0 0 0 3px var(--md-surface-container),
    inset 0 0 0 5px var(--md-yellow);
}

.calendar-day.today.has-event {
  box-shadow: inset 0 0 0 2px var(--md-green), 0 0 0 2px var(--md-surface-container);
}

.calendar-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  color: var(--md-on-surface-variant);
}
.calendar-legend + .calendar-legend { margin-top: 6px; }

.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--md-green);
  flex-shrink: 0;
}

.legend-dot-birthday { border-color: var(--md-yellow); }

/* ==========================================================
   FAB
   ========================================================== */
.fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  border: none;
  border-radius: var(--radius-m);
  height: 56px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow .2s, filter .2s;
  z-index: 20;
}
.fab:hover { filter: brightness(.96); box-shadow: 0 6px 10px 4px rgba(0,0,0,.15), 0 2px 3px rgba(0,0,0,.3); }
.fab .material-symbols-outlined { font-size: 24px; }

/* ==========================================================
   Dialog
   ========================================================== */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.dialog {
  background: var(--md-surface-container-high);
  border-radius: var(--radius-l);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  max-height: 90dvh; /* su mobile segue la viewport ridotta dalla tastiera */
  overflow-y: auto;
  animation: dialog-in .2s ease;
}

@keyframes dialog-in {
  from { transform: scale(.92); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.dialog-title {
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 24px;
}

.confirm-text {
  font-size: 14px;
  color: var(--md-on-surface-variant);
  line-height: 1.5;
  margin-bottom: 24px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Dialog gestione utenti (solo amministratore) ---------- */
.users-admin-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  max-height: 55vh;
  overflow-y: auto;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--md-outline-variant);
}

.user-row:last-child { border-bottom: none; }

.user-row-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row-tag {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--md-error);
}

/* Restrizione attiva: il bottone resta evidenziato col colore d'errore. */
.icon-btn-active {
  color: var(--md-error);
  background: color-mix(in srgb, var(--md-error) 12%, transparent);
}

.users-empty {
  list-style: none;
  font-size: 14px;
  color: var(--md-on-surface-variant);
  padding: 12px 4px;
}

/* ---------- Dialog profilo ---------- */
.profile-photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.profile-avatar-preview .avatar {
  width: 72px;
  height: 72px;
  font-size: 28px;
}

.profile-photo-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.profile-section-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  margin: 4px 0 10px;
}

.theme-mode-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.theme-mode-toggle .btn.mode-selected {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  border-color: var(--md-secondary-container);
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--md-outline-variant);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.color-swatch:hover { transform: scale(1.12); }

.color-swatch.swatch-selected {
  border-color: var(--md-on-surface);
  box-shadow: 0 0 0 2px var(--md-surface-container-high), 0 0 0 4px var(--md-on-surface);
}

/* ==========================================================
   Snackbar
   ========================================================== */
.snackbar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--md-snackbar-bg);
  color: var(--md-snackbar-fg);
  border-radius: 4px;
  padding: 14px 20px;
  font-size: 14px;
  box-shadow: 0 3px 5px rgba(0,0,0,.3);
  z-index: 100;
  animation: snackbar-in .25s ease;
}

@keyframes snackbar-in {
  from { transform: translate(-50%, 16px); opacity: 0; }
  to   { transform: translate(-50%, 0);    opacity: 1; }
}

/* ==========================================================
   Responsive
   ========================================================== */

/* Tablet e schermi stretti: calendario sopra la lista eventi */
@media (max-width: 840px) {
  .app-body { flex-direction: column-reverse; }
  .main-panel, .sidebar { flex: 1 1 auto; max-width: 100%; width: 100%; position: static; }
  .calendar-card { max-width: 320px; margin: 0 auto; }
}

/* Telefoni */
@media (max-width: 600px) {
  /* Spazio in basso perché il FAB non copra l'ultima card */
  .app-body { padding: 16px 12px 96px; gap: 16px; }

  /* Top bar compatta: solo icone e avatar, niente etichette */
  .top-app-bar { padding: 0 8px 0 16px; }
  .top-app-bar-title { font-size: 18px; gap: 8px; }
  .top-app-bar-actions { gap: 4px; }
  .top-app-bar-left .btn-text { padding: 10px 12px; margin-left: 0; }
  .top-app-bar-left .btn-label { display: none; }
  #user-name { display: none; }
  .user-chip { padding: 4px; }

  /* Tendina notifiche ancorata sotto la barra, a tutta larghezza */
  .notif-dropdown {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
  }

  /* Card evento: data/ora sotto il titolo, azioni a tutta larghezza */
  .event-card { padding: 16px; }
  .event-card-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .event-datetime { align-self: flex-start; }
  .event-footer > .btn { width: 100%; justify-content: center; }
  .event-actions { width: 100%; }
  .event-actions .btn { flex: 1; justify-content: center; }

  /* Calendario a larghezza piena: celle più grandi da toccare */
  .calendar-card { max-width: 360px; }

  /* FAB solo icona */
  .fab { right: 16px; bottom: 16px; width: 56px; padding: 0; justify-content: center; }
  .fab-label { display: none; }

  /* Dialog in alto, così la tastiera non copre i campi */
  .scrim { padding: 12px; align-items: flex-start; }
  .dialog {
    margin-top: 12px;
    padding: 20px;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
  }
  .dialog-title { font-size: 20px; margin-bottom: 18px; }

  /* Snackbar sopra il FAB */
  .snackbar {
    bottom: 88px;
    width: calc(100vw - 32px);
    max-width: 420px;
    text-align: center;
  }

  /* Login più compatto */
  .login-screen { padding: 16px; }
  .login-card { padding: 28px 24px; }
}

/* Schermi molto stretti: data e ora in colonna nei dialog */
@media (max-width: 420px) {
  .field-row { flex-direction: column; gap: 0; }
}
