.modal-wrap,
.toast-wrap {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
}

.modal-wrap {
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.25);
  pointer-events: auto;
  animation: fadeIn 180ms ease;
}

.modal-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: scaleIn 200ms ease;
}

.preview-modal {
  width: min(1080px, 100%);
  max-height: min(88vh, 980px);
  display: flex;
  flex-direction: column;
}

.preview-modal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  flex-shrink: 0;
}

.preview-modal .modal-header-title {
  min-width: 0;
  flex: 1;
}

.preview-modal .modal-header-title .modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-modal .modal-header-title .modal-copy {
  margin-top: 4px;
  font-size: 13px;
}

.preview-modal .modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.modal-copy {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.modal-form {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.toast-wrap {
  display: grid;
  place-items: end center;
  padding: 24px;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 16px;
  color: white;
  background: var(--toast-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  animation: fadeSlideDown 220ms ease;
}

.toast[data-type="success"] {
  background: rgba(24, 121, 78, 0.95);
}

.toast[data-type="error"] {
  background: rgba(192, 57, 43, 0.95);
}
