.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 24px;
  background: var(--overlay-bg);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  position: relative;
  width: min(100%, 560px);
  padding: 28px 24px 20px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  margin: auto 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--overlay-shadow);
}

.modal-title {
  font-size: 24px;
  margin: 0 44px 8px 0;
}

.modal-copy {
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.modal-panel .file-upload-form {
  gap: 8px;
}

.modal-panel .form-group {
  gap: 4px;
  margin-bottom: 0;
}

.modal-panel .form-help {
  margin: 0;
}

.modal-panel input.visually-hidden {
  width: 1px !important;
  height: 1px !important;
  min-width: 1px;
  padding: 0 !important;
  border: 0 !important;
  font-size: 0;
}

.modal-panel .file-upload-dropzone {
  min-height: 104px;
  gap: 4px;
  padding: 12px;
}

.modal-panel .file-upload-dropzone-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
}

.modal-panel .file-upload-dropzone span {
  font-size: 14px;
}

.modal-panel .file-upload-dropzone small {
  font-size: 12px;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}

.modal-close:hover,
.modal-close:focus-visible {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}

.btn--modal {
  min-width: 136px;
  min-height: 42px;
}

@media (max-width: 640px) {
  .modal-backdrop {
    padding: 12px;
  }

  .modal-panel {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 16px 14px 14px;
  }

  .modal-actions {
    flex-direction: row;
    gap: 8px;
  }

  .btn--modal {
    flex: 1;
    width: auto;
    min-width: 0;
    min-height: 40px;
    padding-left: 8px;
    padding-right: 8px;
  }
}
