body.auth-pending > .sidebar,
body.auth-pending > main,
body.auth-locked > .sidebar,
body.auth-locked > main {
  visibility: hidden;
  pointer-events: none;
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logout-button {
  white-space: nowrap;
}

#cloud-conflict {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(25, 5, 43, 0.82);
  backdrop-filter: blur(10px);
}
#cloud-conflict[hidden] {
  display: none;
}
.cloud-conflict-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 24px;
  background: linear-gradient(145deg, #32115c, #642386);
  padding: 28px;
  color: #fff;
  box-shadow: 0 30px 90px rgba(10, 0, 20, 0.55);
}
.cloud-conflict-card h2 {
  margin-bottom: 10px;
  color: #ffd329;
}
.cloud-conflict-card p {
  color: #eadff1;
  line-height: 1.55;
}
.cloud-conflict-list {
  max-height: 150px;
  overflow: auto;
  margin: 16px 0;
  padding: 12px 12px 12px 30px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
}
.cloud-conflict-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.cloud-conflict-actions > * {
  flex: 1 1 190px;
}

.backup-progress {
  margin-top: 14px;
  color: #5b4470;
  font-size: 12px;
  font-weight: 700;
}
.backup-progress progress {
  width: 100%;
  height: 9px;
  margin-top: 7px;
  accent-color: #5d227f;
}
.security-note {
  margin-top: 12px;
  border-radius: 11px;
  background: #fff8d8;
  padding: 11px;
  color: #5b4510;
  font-size: 12px;
  line-height: 1.45;
}

/* Schede atleta: contenuto scorrevole e comandi sempre raggiungibili. */
#profile-dialog.profile-modal[open] {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden !important;
}
#profile-dialog > .close-profile {
  position: absolute !important;
  z-index: 40;
  top: 18px;
  right: 18px;
  float: none;
}
#profile-dialog .profile-scroll-body {
  min-height: 0;
  flex: 1 1 auto;
  margin: -29px -29px 0;
  padding: 29px 29px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
#profile-dialog .profile-actions {
  z-index: 30;
  flex: 0 0 auto;
  margin: 16px -29px -29px !important;
  padding: 14px 29px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid #e5dbea;
  background: rgba(249, 246, 253, 0.98);
  box-shadow: 0 -12px 28px rgba(44, 14, 69, 0.12);
}

/* Modifica atleta: intestazione e pulsanti restano fermi, scorrono solo i campi. */
#athlete-dialog[open] {
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden !important;
}
#athlete-dialog #athlete-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  overflow: hidden;
}
#athlete-dialog .form-grid {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 3px;
  margin: -3px;
  -webkit-overflow-scrolling: touch;
}
#athlete-dialog .modal-title,
#athlete-dialog .modal-actions {
  flex: 0 0 auto;
}

@media (max-width: 760px) {
  #profile-dialog .profile-scroll-body {
    margin: -18px -14px 0;
    padding: 18px 14px 0;
  }
  #profile-dialog .profile-actions {
    position: relative !important;
    bottom: auto;
    margin: 14px -14px -10px !important;
    padding: 12px 14px max(12px, env(safe-area-inset-bottom));
  }
  #profile-dialog > .close-profile {
    top: 12px;
    right: 12px;
  }
  #athlete-dialog #athlete-form {
    height: 100%;
    max-height: none;
  }
  #athlete-dialog .modal-title {
    position: relative;
    top: auto;
  }
  #athlete-dialog .modal-actions {
    position: relative;
    bottom: auto;
  }
}

@media (max-width: 700px) {
  .session-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .logout-button {
    padding: 9px 11px;
  }
  .cloud-conflict-card {
    padding: 21px 17px;
  }
  .cloud-conflict-actions {
    flex-direction: column;
  }
}
